Skip to content

Instantly share code, notes, and snippets.

@krutcha
Created January 16, 2016 22:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krutcha/71608f3a63d16870658b to your computer and use it in GitHub Desktop.
Save krutcha/71608f3a63d16870658b to your computer and use it in GitHub Desktop.
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