Created
January 16, 2016 22:05
-
-
Save krutcha/71608f3a63d16870658b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Requests | |
import Requests: get, post, options, json | |
#Me | |
apikey = "f00c0ffee" | |
symbol = "PGYU" | |
venue = "UQPEX" | |
sharecount = Int64(100000) | |
baseurl = "https://api.stockfighter.io/ob/api" | |
account = "MA71815335" | |
function sfBuy(account::ASCIIString, | |
venue::ASCIIString, | |
symbol::ASCIIString, | |
price::Int64, | |
sharecount::Int64, | |
orderType::ASCIIString) | |
json(Requests.post( | |
baseurl*"/venues/$venue/stocks/$symbol/orders"; | |
json = Dict( | |
"account" => account, | |
"venue" => venue, | |
"symbol" => symbol, | |
"price" => price, | |
"qty" => sharecount, | |
"direction" => "buy", | |
"orderType" => orderType), | |
headers = Dict("X-Starfighter-Authorization" => apikey) | |
)) | |
end | |
function sfQuote(venue::ASCIIString, | |
symbol::ASCIIString) | |
json(Requests.post( | |
baseurl*"/venues/$venue/stocks/$symbol/quote"; | |
json = Dict( | |
"venue" => venue, | |
"symbol" => symbol) | |
)) | |
end | |
#this runs fine | |
sfBuy(account, venue, symbol, 0, sharecount, "immediate-or-cancel") | |
#this gives the error | |
sfQuote(venue, symbol) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment