my_module_path = joinpath(pwd(),"BinanceAPI")
push!(LOAD_PATH, my_module_path)
LOAD_PATH
4-element Vector{String}: "@" "@v#.#" "@stdlib" "c:\\Dev\\julia_dev\\binance\\BinanceAPI"
using PrettyPrint: pprint
using BenchmarkTools: @btime
import Plots
# import StatsPlots
import TimeSeries
# StatsPlots.gr()
Plots.gr()
Plots.GRBackend()
using DataFrames: select,rename!
using BinanceAPI
┌ Info: Precompiling BinanceAPI [62a0a4ca-51d6-43ca-8e2e-c90927598c78] └ @ Base loading.jl:1317
ENV["COLUMNS"] = 300
ENV["LINES"] = 10
10
set_env()
apikey()
("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy")
local_st2utc_dt("2021-09-06 20:33:12")
2021-09-06T11:33:12
utc_ts2local_dt.([1630929276437,1630929276437])
2-element Vector{Dates.DateTime}: 2021-09-06T20:54:36.437 2021-09-06T20:54:36.437
ping()
Dict{String, Any} with 3 entries: "msg" => "" "success" => true "data" => 200
# UTC server datetime > datetime to timestamp > UTC timestamp to Local datetime
server_time()["data"] |> dt2ts |> utc_ts2local_dt
2021-09-29T13:43:52.859
pprint(exchange_info2(["XRPUSDT","BTCUSDT"])["data"])
{ "symbols" : { "BTCUSDT" : { "orderTypes" : ["LIMIT", "LIMIT_MAKER", "MARKET", "STOP_LOSS_LIMIT", "TAKE_PROFIT_LIMIT"], "ocoAllowed" : true, "isSpotTradingAllowed" : true, "baseAssetPrecision" : 8, "quoteAsset" : "USDT", "status" : "TRADING", "icebergAllowed" : true, "quoteAssetPrecision" : 8, "quoteOrderQtyMarketAllowed" : true, "permissions" : ["SPOT",], "baseCommissionPrecision" : 8, "filters" : { "MAX_NUM_ORDERS" : {"maxNumOrders" : 200,}, "PRICE_FILTER" : {"maxPrice" : "1000000.00000000", "minPrice" : "0.01000000", "tickSize" : "0.01000000"}, "PERCENT_PRICE" : {"multiplierDown" : "0.2", "multiplierUp" : "5", "avgPriceMins" : 5}, "LOT_SIZE" : {"minQty" : "0.00000100", "maxQty" : "900.00000000", "stepSize" : "0.00000100"}, "MIN_NOTIONAL" : {"minNotional" : "10.00000000", "applyToMarket" : true, "avgPriceMins" : 5}, "MARKET_LOT_SIZE" : {"minQty" : "0.00000000", "maxQty" : "100.00000000", "stepSize" : "0.00000000"}, "ICEBERG_PARTS" : {"limit" : 10,}, "MAX_NUM_ALGO_ORDERS" : {"maxNumAlgoOrders" : 5,}, }, "baseAsset" : "BTC", "quotePrecision" : 8, "quoteCommissionPrecision" : 8, "isMarginTradingAllowed" : false, }, "XRPUSDT" : { "orderTypes" : ["LIMIT", "LIMIT_MAKER", "MARKET", "STOP_LOSS_LIMIT", "TAKE_PROFIT_LIMIT"], "ocoAllowed" : true, "isSpotTradingAllowed" : true, "baseAssetPrecision" : 8, "quoteAsset" : "USDT", "status" : "TRADING", "icebergAllowed" : true, "quoteAssetPrecision" : 8, "quoteOrderQtyMarketAllowed" : true, "permissions" : ["SPOT",], "baseCommissionPrecision" : 8, "filters" : { "MAX_NUM_ORDERS" : {"maxNumOrders" : 200,}, "PRICE_FILTER" : {"maxPrice" : "1000.00000000", "minPrice" : "0.00010000", "tickSize" : "0.00010000"}, "PERCENT_PRICE" : {"multiplierDown" : "0.2", "multiplierUp" : "5", "avgPriceMins" : 5}, "LOT_SIZE" : {"minQty" : "0.10000000", "maxQty" : "90000.00000000", "stepSize" : "0.10000000"}, "MIN_NOTIONAL" : {"minNotional" : "10.00000000", "applyToMarket" : true, "avgPriceMins" : 5}, "MARKET_LOT_SIZE" : {"minQty" : "0.00000000", "maxQty" : "10000.00000000", "stepSize" : "0.00000000"}, "ICEBERG_PARTS" : {"limit" : 10,}, "MAX_NUM_ALGO_ORDERS" : {"maxNumAlgoOrders" : 5,}, }, "baseAsset" : "XRP", "quotePrecision" : 8, "quoteCommissionPrecision" : 8, "isMarginTradingAllowed" : false, }, }, "rateLimits" : { "DAY" : {"intervalNum" : 1, "rateLimitType" : "ORDERS", "limit" : 160000}, "MINUTE" : {"intervalNum" : 1, "rateLimitType" : "REQUEST_WEIGHT", "limit" : 1200}, "SECOND" : {"intervalNum" : 10, "rateLimitType" : "ORDERS", "limit" : 50}, }, "exchangeFilters" : [], "serverTime" : 1632890633403, "timezone" : "UTC", }
set_env(prod=true)
exinfo=exchange_info(["ARUSDT","BTCUSDT"])
set_env()
pprint(exinfo)
{ "msg" : "", "success" : true, "data" : { "symbols" : [ { "orderTypes" : ["LIMIT", "LIMIT_MAKER", "MARKET", "STOP_LOSS_LIMIT", "TAKE_PROFIT_LIMIT"], "ocoAllowed" : true, "isSpotTradingAllowed" : true, "baseAssetPrecision" : 8, "quoteAsset" : "USDT", "status" : "TRADING", "icebergAllowed" : true, "quoteAssetPrecision" : 8, "quoteOrderQtyMarketAllowed" : true, "symbol" : "BTCUSDT", "permissions" : ["SPOT", "MARGIN"], "baseCommissionPrecision" : 8, "filters" : [ {"filterType" : "PRICE_FILTER", "maxPrice" : "1000000.00000000", "minPrice" : "0.01000000", "tickSize" : "0.01000000"}, {"multiplierDown" : "0.2", "multiplierUp" : "5", "filterType" : "PERCENT_PRICE", "avgPriceMins" : 5}, {"filterType" : "LOT_SIZE", "minQty" : "0.00001000", "maxQty" : "9000.00000000", "stepSize" : "0.00001000"}, {"minNotional" : "10.00000000", "filterType" : "MIN_NOTIONAL", "applyToMarket" : true, "avgPriceMins" : 5}, {"filterType" : "ICEBERG_PARTS", "limit" : 10}, {"filterType" : "MARKET_LOT_SIZE", "minQty" : "0.00000000", "maxQty" : "155.63779365", "stepSize" : "0.00000000"}, {"filterType" : "MAX_NUM_ORDERS", "maxNumOrders" : 200}, {"filterType" : "MAX_NUM_ALGO_ORDERS", "maxNumAlgoOrders" : 5}, ], "baseAsset" : "BTC", "quotePrecision" : 8, "quoteCommissionPrecision" : 8, "isMarginTradingAllowed" : true, }, { "orderTypes" : ["LIMIT", "LIMIT_MAKER", "MARKET", "STOP_LOSS_LIMIT", "TAKE_PROFIT_LIMIT"], "ocoAllowed" : true, "isSpotTradingAllowed" : true, "baseAssetPrecision" : 8, "quoteAsset" : "USDT", "status" : "TRADING", "icebergAllowed" : true, "quoteAssetPrecision" : 8, "quoteOrderQtyMarketAllowed" : true, "symbol" : "ARUSDT", "permissions" : ["SPOT",], "baseCommissionPrecision" : 8, "filters" : [ {"filterType" : "PRICE_FILTER", "maxPrice" : "100000.00000000", "minPrice" : "0.01000000", "tickSize" : "0.01000000"}, {"multiplierDown" : "0.2", "multiplierUp" : "5", "filterType" : "PERCENT_PRICE", "avgPriceMins" : 5}, {"filterType" : "LOT_SIZE", "minQty" : "0.01000000", "maxQty" : "100000.00000000", "stepSize" : "0.01000000"}, {"minNotional" : "10.00000000", "filterType" : "MIN_NOTIONAL", "applyToMarket" : true, "avgPriceMins" : 5}, {"filterType" : "ICEBERG_PARTS", "limit" : 10}, {"filterType" : "MARKET_LOT_SIZE", "minQty" : "0.00000000", "maxQty" : "13683.98264583", "stepSize" : "0.00000000"}, {"filterType" : "MAX_NUM_ORDERS", "maxNumOrders" : 200}, {"filterType" : "MAX_NUM_ALGO_ORDERS", "maxNumAlgoOrders" : 5}, ], "baseAsset" : "AR", "quotePrecision" : 8, "quoteCommissionPrecision" : 8, "isMarginTradingAllowed" : false, }, ], "rateLimits" : [ {"intervalNum" : 1, "interval" : "MINUTE", "rateLimitType" : "REQUEST_WEIGHT", "limit" : 1200}, {"intervalNum" : 10, "interval" : "SECOND", "rateLimitType" : "ORDERS", "limit" : 50}, {"intervalNum" : 1, "interval" : "DAY", "rateLimitType" : "ORDERS", "limit" : 160000}, {"intervalNum" : 5, "interval" : "MINUTE", "rateLimitType" : "RAW_REQUESTS", "limit" : 6100}, ], "exchangeFilters" : [], "serverTime" : 1632890635381, "timezone" : "UTC", }, }
set_env(prod=true)
ob = orderbook("ARUSDT",limit=5)
sob = symbol_orderbook_ticker("ARUSDT")
set_env()
display(sob["data"])
append!(ob["data"]["asksDF"],ob["data"]["bidsDF"])
1 rows × 5 columns
askPrice | askQty | bidPrice | bidQty | symbol | |
---|---|---|---|---|---|
Float64 | Float64 | Float64 | Float64 | String | |
1 | 43.68 | 41.65 | 43.66 | 2.15 | ARUSDT |
10 rows × 2 columns
price | qty | |
---|---|---|
Float64 | Float64 | |
1 | 43.74 | 3.93 |
2 | 43.73 | 3.31 |
3 | 43.7 | 46.37 |
4 | 43.69 | 5.72 |
5 | 43.68 | 41.65 |
6 | 43.66 | 2.15 |
7 | 43.64 | 1.14 |
8 | 43.63 | 20.11 |
9 | 43.62 | 47.61 |
10 | 43.61 | 424.28 |
rtl = recent_trades_list("ETHUSDT")
rtl["data"]
500 rows × 8 columns
id | isBestMatch | isBuyerMaker | price | qty | quoteQty | time | timeDtLocal | |
---|---|---|---|---|---|---|---|---|
Int64 | Bool | Bool | Float64 | Float64 | Float64 | Int64 | DateTim… | |
1 | 4849 | 1 | 1 | 3.65 | 10.0 | 36.5 | 1632890607955 | 2021-09-29T13:43:27.955 |
2 | 4848 | 1 | 0 | 817.84 | 0.61136 | 499.995 | 1632890440519 | 2021-09-29T13:40:40.519 |
3 | 4847 | 1 | 1 | 3.65 | 2.60159 | 9.4958 | 1632890407761 | 2021-09-29T13:40:07.761 |
4 | 4846 | 1 | 0 | 817.84 | 0.21991 | 179.851 | 1632890401633 | 2021-09-29T13:40:01.633 |
5 | 4845 | 1 | 0 | 768.76 | 2.38168 | 1830.94 | 1632890401633 | 2021-09-29T13:40:01.633 |
6 | 4844 | 1 | 0 | 768.76 | 0.65039 | 499.994 | 1632890401140 | 2021-09-29T13:40:01.140 |
7 | 4843 | 1 | 1 | 3.65 | 9.48401 | 34.6166 | 1632890144449 | 2021-09-29T13:35:44.449 |
8 | 4842 | 1 | 1 | 3.69 | 0.51599 | 1.904 | 1632890144449 | 2021-09-29T13:35:44.449 |
9 | 4841 | 1 | 1 | 3.69 | 10.0 | 36.9 | 1632890106036 | 2021-09-29T13:35:06.036 |
10 | 4840 | 1 | 1 | 3.69 | 1.0 | 3.69 | 1632890028134 | 2021-09-29T13:33:48.134 |
⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ |
set_env(prod=true)
rtl = recent_trades_list("ARUSDT")
otl = old_trades_list("ARUSDT")
# otl = old_trades_list("ARUSDT";fromid=8950988)
set_env()
display(rtl["data"])
otl["data"]
500 rows × 8 columns
id | isBestMatch | isBuyerMaker | price | qty | quoteQty | time | timeDtLocal | |
---|---|---|---|---|---|---|---|---|
Int64 | Bool | Bool | Float64 | Float64 | Float64 | Int64 | DateTim… | |
1 | 10870365 | 1 | 0 | 43.7 | 1.33 | 58.121 | 1632890643147 | 2021-09-29T13:44:03.147 |
2 | 10870364 | 1 | 0 | 43.7 | 1.97 | 86.089 | 1632890643147 | 2021-09-29T13:44:03.147 |
3 | 10870363 | 1 | 0 | 43.68 | 29.67 | 1295.99 | 1632890643079 | 2021-09-29T13:44:03.079 |
4 | 10870362 | 1 | 0 | 43.68 | 11.98 | 523.286 | 1632890643079 | 2021-09-29T13:44:03.079 |
5 | 10870361 | 1 | 1 | 43.66 | 8.64 | 377.222 | 1632890633263 | 2021-09-29T13:43:53.263 |
6 | 10870360 | 1 | 0 | 43.68 | 4.0 | 174.72 | 1632890633048 | 2021-09-29T13:43:53.048 |
7 | 10870359 | 1 | 0 | 43.68 | 5.16 | 225.389 | 1632890628431 | 2021-09-29T13:43:48.431 |
8 | 10870358 | 1 | 0 | 43.67 | 1.14 | 49.7838 | 1632890628431 | 2021-09-29T13:43:48.431 |
9 | 10870357 | 1 | 1 | 43.63 | 3.42 | 149.215 | 1632890618822 | 2021-09-29T13:43:38.822 |
10 | 10870356 | 1 | 1 | 43.64 | 1.14 | 49.7496 | 1632890618822 | 2021-09-29T13:43:38.822 |
⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ |
500 rows × 8 columns
id | isBestMatch | isBuyerMaker | price | qty | quoteQty | time | timeDtLocal | |
---|---|---|---|---|---|---|---|---|
Int64 | Bool | Bool | Float64 | Float64 | Float64 | Int64 | DateTim… | |
1 | 10870365 | 1 | 0 | 43.7 | 1.33 | 58.121 | 1632890643147 | 2021-09-29T13:44:03.147 |
2 | 10870364 | 1 | 0 | 43.7 | 1.97 | 86.089 | 1632890643147 | 2021-09-29T13:44:03.147 |
3 | 10870363 | 1 | 0 | 43.68 | 29.67 | 1295.99 | 1632890643079 | 2021-09-29T13:44:03.079 |
4 | 10870362 | 1 | 0 | 43.68 | 11.98 | 523.286 | 1632890643079 | 2021-09-29T13:44:03.079 |
5 | 10870361 | 1 | 1 | 43.66 | 8.64 | 377.222 | 1632890633263 | 2021-09-29T13:43:53.263 |
6 | 10870360 | 1 | 0 | 43.68 | 4.0 | 174.72 | 1632890633048 | 2021-09-29T13:43:53.048 |
7 | 10870359 | 1 | 0 | 43.68 | 5.16 | 225.389 | 1632890628431 | 2021-09-29T13:43:48.431 |
8 | 10870358 | 1 | 0 | 43.67 | 1.14 | 49.7838 | 1632890628431 | 2021-09-29T13:43:48.431 |
9 | 10870357 | 1 | 1 | 43.63 | 3.42 | 149.215 | 1632890618822 | 2021-09-29T13:43:38.822 |
10 | 10870356 | 1 | 1 | 43.64 | 1.14 | 49.7496 | 1632890618822 | 2021-09-29T13:43:38.822 |
⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ |
set_env(prod=true)
agg = agg_trades_list("ARUSDT")
# 1631258645981 , 1631258648024
set_env()
display(agg["msg"])
agg["data"]
""
500 rows × 9 columns
M | T | a | f | l | m | p | q | TDtLocal | |
---|---|---|---|---|---|---|---|---|---|
Bool | Int64 | Int64 | Int64 | Int64 | Bool | Float64 | Float64 | DateTim… | |
1 | 1 | 1632890643147 | 7015335 | 10870364 | 10870365 | 0 | 43.7 | 3.3 | 2021-09-29T13:44:03.147 |
2 | 1 | 1632890643079 | 7015334 | 10870362 | 10870363 | 0 | 43.68 | 41.65 | 2021-09-29T13:44:03.079 |
3 | 1 | 1632890633263 | 7015333 | 10870361 | 10870361 | 1 | 43.66 | 8.64 | 2021-09-29T13:43:53.263 |
4 | 1 | 1632890633048 | 7015332 | 10870360 | 10870360 | 0 | 43.68 | 4.0 | 2021-09-29T13:43:53.048 |
5 | 1 | 1632890628431 | 7015330 | 10870358 | 10870358 | 0 | 43.67 | 1.14 | 2021-09-29T13:43:48.431 |
6 | 1 | 1632890628431 | 7015331 | 10870359 | 10870359 | 0 | 43.68 | 5.16 | 2021-09-29T13:43:48.431 |
7 | 1 | 1632890618822 | 7015328 | 10870356 | 10870356 | 1 | 43.64 | 1.14 | 2021-09-29T13:43:38.822 |
8 | 1 | 1632890618822 | 7015329 | 10870357 | 10870357 | 1 | 43.63 | 3.42 | 2021-09-29T13:43:38.822 |
9 | 1 | 1632890618760 | 7015327 | 10870355 | 10870355 | 0 | 43.68 | 20.27 | 2021-09-29T13:43:38.760 |
10 | 1 | 1632890616758 | 7015326 | 10870354 | 10870354 | 0 | 43.67 | 1.14 | 2021-09-29T13:43:36.758 |
⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ |
TimeSeries candlestick사용은 Open, High, Low, Close로 변경
set_env(prod=true)
cdd = candlestick_data("ARUSDT",interval="15m",limit=100)
set_env()
cb = cdd["data"]
display(cb)
ohlc = select(cb,
:tDtLocal, :o,:h,:l,:c,copycols=false)
rename!(ohlc,:tDtLocal=>:t,
:o=>:Open,:h=>:High,:l=>:Low,:c=>:Close)
display(ohlc)
ts = TimeSeries.TimeArray(ohlc,timestamp = :t)
Plots.plot(ts, seriestype = :candlestick,xrotation = 60,
xtickfont=Plots.font(8),xticks = 10 )
100 rows × 14 columns
t | o | h | l | c | v | T | q | n | V | Q | B | tDtLocal | TDtLocal | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Int64 | Float64 | Float64 | Float64 | Float64 | Float64 | Int64 | Float64 | Int64 | Float64 | Float64 | String | DateTim… | DateTim… | |
1 | 1632889800000 | 44.12 | 44.2 | 43.42 | 43.7 | 5690.33 | 1632890699999 | 2.48543e5 | 928 | 2613.56 | 114163.0 | 0 | 2021-09-29T13:30:00 | 2021-09-29T13:44:59.999 |
2 | 1632888900000 | 43.42 | 44.26 | 43.42 | 44.13 | 14090.2 | 1632889799999 | 6.20348e5 | 2744 | 7801.47 | 3.43612e5 | 0 | 2021-09-29T13:15:00 | 2021-09-29T13:29:59.999 |
3 | 1632888000000 | 41.93 | 43.87 | 41.92 | 43.42 | 21301.8 | 1632888899999 | 9.11728e5 | 3401 | 16446.2 | 7.04366e5 | 0 | 2021-09-29T13:00:00 | 2021-09-29T13:14:59.999 |
4 | 1632887100000 | 41.05 | 42.0 | 41.02 | 41.94 | 4717.65 | 1632887999999 | 1.96311e5 | 845 | 2930.31 | 121907.0 | 0 | 2021-09-29T12:45:00 | 2021-09-29T12:59:59.999 |
5 | 1632886200000 | 41.13 | 41.4 | 41.01 | 41.01 | 2096.4 | 1632887099999 | 86356.3 | 523 | 742.49 | 30573.4 | 0 | 2021-09-29T12:30:00 | 2021-09-29T12:44:59.999 |
6 | 1632885300000 | 41.13 | 41.16 | 40.67 | 41.14 | 3236.13 | 1632886199999 | 1.3234e5 | 586 | 1374.06 | 56216.3 | 0 | 2021-09-29T12:15:00 | 2021-09-29T12:29:59.999 |
7 | 1632884400000 | 41.33 | 41.47 | 40.99 | 41.1 | 3478.54 | 1632885299999 | 1.43294e5 | 498 | 2298.49 | 94691.0 | 0 | 2021-09-29T12:00:00 | 2021-09-29T12:14:59.999 |
8 | 1632883500000 | 41.61 | 41.61 | 41.07 | 41.33 | 4996.36 | 1632884399999 | 2.06508e5 | 800 | 2117.2 | 87484.4 | 0 | 2021-09-29T11:45:00 | 2021-09-29T11:59:59.999 |
9 | 1632882600000 | 41.36 | 41.68 | 41.08 | 41.61 | 5326.28 | 1632883499999 | 2.20363e5 | 832 | 3014.08 | 1.248e5 | 0 | 2021-09-29T11:30:00 | 2021-09-29T11:44:59.999 |
10 | 1632881700000 | 40.27 | 41.4 | 40.26 | 41.39 | 12252.8 | 1632882599999 | 5.00038e5 | 1664 | 6270.04 | 2.55999e5 | 0 | 2021-09-29T11:15:00 | 2021-09-29T11:29:59.999 |
⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ |
100 rows × 5 columns
t | Open | High | Low | Close | |
---|---|---|---|---|---|
DateTim… | Float64 | Float64 | Float64 | Float64 | |
1 | 2021-09-29T13:30:00 | 44.12 | 44.2 | 43.42 | 43.7 |
2 | 2021-09-29T13:15:00 | 43.42 | 44.26 | 43.42 | 44.13 |
3 | 2021-09-29T13:00:00 | 41.93 | 43.87 | 41.92 | 43.42 |
4 | 2021-09-29T12:45:00 | 41.05 | 42.0 | 41.02 | 41.94 |
5 | 2021-09-29T12:30:00 | 41.13 | 41.4 | 41.01 | 41.01 |
6 | 2021-09-29T12:15:00 | 41.13 | 41.16 | 40.67 | 41.14 |
7 | 2021-09-29T12:00:00 | 41.33 | 41.47 | 40.99 | 41.1 |
8 | 2021-09-29T11:45:00 | 41.61 | 41.61 | 41.07 | 41.33 |
9 | 2021-09-29T11:30:00 | 41.36 | 41.68 | 41.08 | 41.61 |
10 | 2021-09-29T11:15:00 | 40.27 | 41.4 | 40.26 | 41.39 |
⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ |
set_env(prod=true)
ca = current_avg_price("ARUSDT")["data"]
set_env()
ca
1 rows × 2 columns
mins | price | |
---|---|---|
Int64 | Float64 | |
1 | 5 | 43.6558 |
df = get24hr()["data"]
20 rows × 23 columns
askPrice | askQty | bidPrice | bidQty | closeTime | count | firstId | highPrice | lastId | lastPrice | lastQty | lowPrice | openPrice | openTime | prevClosePrice | priceChange | priceChangePercent | quoteVolume | symbol | volume | weightedAvgPrice | openTimeDtLocal | closeTimeDtLocal | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Float64 | Float64 | Float64 | Float64 | Int64 | Int64 | Int64 | Float64 | Int64 | Float64 | Float64 | Float64 | Float64 | Int64 | Float64 | Float64 | Float64 | Float64 | String | Float64 | Float64 | DateTim… | DateTim… | |
1 | 26.01 | 351.75 | 0.65 | 570.28 | 1632889492224 | 125 | 2207 | 27.02 | 2331 | 27.02 | 286.52 | 0.65 | 27.02 | 1632803092224 | 23.79 | 0.0 | 0.0 | 29438.2 | BNBBUSD | 1610.53 | 18.2786 | 2021-09-28T13:24:52.224 | 2021-09-29T13:24:52.224 |
2 | 52085.0 | 1.82967 | 20000.0 | 0.01 | 1632887999178 | 34 | 1182 | 52085.0 | 1215 | 410.0 | 0.803556 | 410.0 | 52085.0 | 1632801599178 | 52085.0 | -51675.0 | -99.213 | 19441.9 | BTCBUSD | 1.23123 | 15790.7 | 2021-09-28T12:59:59.178 | 2021-09-29T12:59:59.178 |
3 | 0.0 | 0.0 | 0.42 | 857.143 | 1632852668794 | 145 | 402 | 0.42 | 546 | 0.42 | 476.19 | 0.41 | 0.41 | 1632766268794 | 0.41 | 0.01 | 2.439 | 2653.04 | ETHBUSD | 6459.22 | 0.410737 | 2021-09-28T03:11:08.794 | 2021-09-29T03:11:08.794 |
4 | 36.97 | 4202.92 | 1.48 | 2581.36 | 1632816533201 | 7 | 392 | 36.97 | 398 | 36.97 | 11.6656 | 36.97 | 36.97 | 1632730133201 | 36.97 | 0.0 | 0.0 | 431.277 | LTCBUSD | 11.6656 | 36.97 | 2021-09-27T17:08:53.201 | 2021-09-28T17:08:53.201 |
5 | 0.005 | 1.18499e5 | 0.0 | 0.0 | 1632830297142 | 1 | 75 | 0.005 | 75 | 0.005 | 2500.0 | 0.005 | 0.005 | 1632743897142 | 0.005 | 0.0 | 0.0 | 12.5 | TRXBUSD | 2500.0 | 0.005 | 2021-09-27T20:58:17.142 | 2021-09-28T20:58:17.142 |
6 | 0.45 | 85058.7 | 0.004 | 1.08287e5 | 1632865471625 | 6 | 87 | 0.004 | 92 | 0.004 | 50000.0 | 0.004 | 0.004 | 1632779071625 | 0.004 | 0.0 | 0.0 | 200.0 | XRPBUSD | 50000.0 | 0.004 | 2021-09-28T06:44:31.625 | 2021-09-29T06:44:31.625 |
7 | 343.84 | 27.46 | 342.4 | 1.47 | 1632890672505 | 13353 | 344911 | 343.94 | 358263 | 342.3 | 1.58 | 67.0 | 339.9 | 1632804272505 | 340.2 | 2.4 | 0.706 | 5.48237e6 | BNBUSDT | 16650.8 | 329.255 | 2021-09-28T13:44:32.505 | 2021-09-29T13:44:32.505 |
8 | 42316.5 | 0.011816 | 42316.5 | 0.011816 | 1632890676393 | 157340 | 1487094 | 1.52813e5 | 1644433 | 42316.5 | 0.023632 | 8717.62 | 42625.7 | 1632804276393 | 42627.9 | -309.24 | -0.725 | 4.5426e7 | BTCUSDT | 1088.52 | 41732.0 | 2021-09-28T13:44:36.393 | 2021-09-29T13:44:36.393 |
9 | 817.84 | 1.09545 | 3.65 | 4725.1 | 1632890644465 | 259 | 4591 | 2191.25 | 4849 | 3.65 | 10.0 | 3.65 | 2037.04 | 1632804244465 | 3.76 | -2033.39 | -99.821 | 1.06266e5 | ETHUSDT | 650.186 | 163.439 | 2021-09-28T13:44:04.465 | 2021-09-29T13:44:04.465 |
10 | 51.05 | 2697.57 | 51.04 | 601.036 | 1632888827687 | 39 | 2051 | 100.0 | 2089 | 51.04 | 0.45 | 51.04 | 100.0 | 1632802427687 | 48.95 | -48.96 | -48.96 | 69019.7 | LTCUSDT | 1317.1 | 52.403 | 2021-09-28T13:13:47.687 | 2021-09-29T13:13:47.687 |
⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ |
filter(x->x.symbol=="ETHBTC",df)
1 rows × 23 columns
askPrice | askQty | bidPrice | bidQty | closeTime | count | firstId | highPrice | lastId | lastPrice | lastQty | lowPrice | openPrice | openTime | prevClosePrice | priceChange | priceChangePercent | quoteVolume | symbol | volume | weightedAvgPrice | openTimeDtLocal | closeTimeDtLocal | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Float64 | Float64 | Float64 | Float64 | Int64 | Int64 | Int64 | Float64 | Int64 | Float64 | Float64 | Float64 | Float64 | Int64 | Float64 | Float64 | Float64 | Float64 | String | Float64 | Float64 | DateTim… | DateTim… | |
1 | 0.00979 | 72.0174 | 0.0 | 0.0 | 1632879671387 | 46 | 2488 | 0.00979 | 2533 | 0.00979 | 2.18132 | 0.0048 | 0.0097 | 1632793271387 | 0.009594 | 9.0e-5 | 0.928 | 0.401686 | ETHBTC | 41.8662 | 0.0095945 | 2021-09-28T10:41:11.387 | 2021-09-29T10:41:11.387 |
eachrow(df)[1][:askPrice]
26.01
@show ping()
@show server_time()
ping() = Dict{String, Any}("msg" => "", "success" => true, "data" => 200) server_time() = Dict{String, Any}("msg" => "", "success" => true, "data" => Dates.DateTime("2021-09-29T04:44:39.420"))
Dict{String, Any} with 3 entries: "msg" => "" "success" => true "data" => DateTime("2021-09-29T04:44:39.420")
sapi는 real만 지원
key,secret = apikey()
@show key
@show secret
key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" secret = "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"
"yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"
set_env(prod=true)
ss = system_status()
set_env()
pprint(ss)
{ "msg" : "", "success" : true, "data" : {"msg" : "normal", "status" : 0}, }
set_env(prod=true)
aci = all_coin_info()
set_env()
# 데이터가 너무 많기 때문에 2개만 가져온다
pprint(aci["data"][end])
{ "locked" : "0", "isLegalMoney" : false, "ipoable" : "0", "withdrawing" : "0", "name" : "COTI", "ipoing" : "0", "free" : "0", "trading" : true, "storage" : "0", "freeze" : "0", "coin" : "COTI", "networkList" : [ {"depositDesc" : "", "withdrawDesc" : "", "name" : "Binance Chain (BEP2)", "withdrawFee" : "0.29", "withdrawIntegerMultiple" : "0.00000001", "isDefault" : false, "minConfirm" : 1, "withdrawMax" : "10000000000", "withdrawEnable" : true, "sameAddress" : true, "depositEnable" : true, "specialTips" : "Please enter both MEMO and Address data, which are required to deposit COTI BEP2 tokens to your Binance account.", "memoRegex" : "^[0-9A-Za-z\\-_]{1,120}\$", "coin" : "COTI", "unLockConfirm" : 0, "addressRegex" : "^(bnb1)[0-9a-z]{38}\$", "network" : "BNB", "withdrawMin" : "0.58", "resetAddressStatus" : false}, {"depositDesc" : "", "withdrawDesc" : "", "name" : "Binance Smart Chain (BEP20)", "withdrawFee" : "0.29", "withdrawIntegerMultiple" : "0.00000001", "isDefault" : false, "minConfirm" : 15, "withdrawMax" : "10000000000", "specialWithdrawTips" : "The network you have selected is BSC. Please ensure that the withdrawal address supports the Binance Smart Chain network. You will lose your assets if the chosen platform does not support retrievals.", "withdrawEnable" : true, "sameAddress" : false, "depositEnable" : true, "specialTips" : "", "memoRegex" : "", "coin" : "COTI", "unLockConfirm" : 0, "addressRegex" : "^(0x)[0-9A-Fa-f]{40}\$", "network" : "BSC", "withdrawMin" : "0.58", "resetAddressStatus" : false}, {"depositDesc" : "", "withdrawDesc" : "", "name" : "Ethereum (ERC20)", "withdrawFee" : "38", "withdrawIntegerMultiple" : "0.00000001", "isDefault" : true, "minConfirm" : 12, "withdrawMax" : "10000000000", "withdrawEnable" : true, "sameAddress" : false, "depositEnable" : true, "specialTips" : "", "memoRegex" : "", "coin" : "COTI", "unLockConfirm" : 0, "addressRegex" : "^(0x)[0-9A-Fa-f]{40}\$", "network" : "ETH", "withdrawMin" : "76", "resetAddressStatus" : false}, ], "withdrawAllEnable" : true, "depositAllEnable" : true, }
set_env(prod=true)
das = daily_account_snapshot("SPOT")
set_env()
pprint(das["data"])
{ "msg" : "", "snapshotVos" : [ { "data" : { "totalAssetOfBtc" : "0.00000409", "balances" : [ {"locked" : "0", "free" : "0", "asset" : "ADA"}, {"locked" : "0", "free" : "0", "asset" : "AR"}, {"locked" : "0", "free" : "0.00041658", "asset" : "BNB"}, {"locked" : "0", "free" : "0", "asset" : "BTC"}, {"locked" : "0", "free" : "0", "asset" : "ETH"}, {"locked" : "0", "free" : "0", "asset" : "USDT"}, {"locked" : "0", "free" : "0", "asset" : "XRP"}, ], }, "type" : "spot", "updateTime" : 1630367999000, }, { "data" : { "totalAssetOfBtc" : "0.0000041", "balances" : [ {"locked" : "0", "free" : "0", "asset" : "ADA"}, {"locked" : "0", "free" : "0", "asset" : "AR"}, {"locked" : "0", "free" : "0.00041658", "asset" : "BNB"}, {"locked" : "0", "free" : "0", "asset" : "BTC"}, {"locked" : "0", "free" : "0", "asset" : "ETH"}, {"locked" : "0", "free" : "0", "asset" : "USDT"}, {"locked" : "0", "free" : "0", "asset" : "XRP"}, ], }, "type" : "spot", "updateTime" : 1630454399000, }, { "data" : { "totalAssetOfBtc" : "0.00003408", "balances" : [ {"locked" : "0", "free" : "0", "asset" : "ADA"}, {"locked" : "20.99", "free" : "0.00015", "asset" : "AR"}, {"locked" : "0", "free" : "0.00337179", "asset" : "BNB"}, {"locked" : "0", "free" : "0", "asset" : "BTC"}, {"locked" : "0", "free" : "0", "asset" : "ETH"}, {"locked" : "0", "free" : "0", "asset" : "USDT"}, {"locked" : "0", "free" : "0", "asset" : "XRP"}, ], }, "type" : "spot", "updateTime" : 1630540799000, }, { "data" : { "totalAssetOfBtc" : "0.00003336", "balances" : [ {"locked" : "0", "free" : "0", "asset" : "ADA"}, {"locked" : "20.99", "free" : "0.00015", "asset" : "AR"}, {"locked" : "0", "free" : "0.00337179", "asset" : "BNB"}, {"locked" : "0", "free" : "0", "asset" : "BTC"}, {"locked" : "0", "free" : "0", "asset" : "ETH"}, {"locked" : "0", "free" : "0", "asset" : "USDT"}, {"locked" : "0", "free" : "0", "asset" : "XRP"}, ], }, "type" : "spot", "updateTime" : 1630627199000, }, { "data" : { "totalAssetOfBtc" : "0.00003308", "balances" : [ {"locked" : "0", "free" : "0", "asset" : "ADA"}, {"locked" : "20.99", "free" : "0.00015", "asset" : "AR"}, {"locked" : "0", "free" : "0.00337179", "asset" : "BNB"}, {"locked" : "0", "free" : "0", "asset" : "BTC"}, {"locked" : "0", "free" : "0", "asset" : "ETH"}, {"locked" : "0", "free" : "0", "asset" : "USDT"}, {"locked" : "0", "free" : "0", "asset" : "XRP"}, ], }, "type" : "spot", "updateTime" : 1630713599000, }, { "data" : { "totalAssetOfBtc" : "0.00003381", "balances" : [ {"locked" : "0", "free" : "0", "asset" : "ADA"}, {"locked" : "20.99", "free" : "0.00015", "asset" : "AR"}, {"locked" : "0", "free" : "0.00337179", "asset" : "BNB"}, {"locked" : "0", "free" : "0", "asset" : "BTC"}, {"locked" : "0", "free" : "0", "asset" : "ETH"}, {"locked" : "0", "free" : "0", "asset" : "USDT"}, {"locked" : "0", "free" : "0", "asset" : "XRP"}, ], }, "type" : "spot", "updateTime" : 1630799999000, }, { "data" : { "totalAssetOfBtc" : "0.00003292", "balances" : [ {"locked" : "0", "free" : "0", "asset" : "ADA"}, {"locked" : "20.99", "free" : "0.00015", "asset" : "AR"}, {"locked" : "0", "free" : "0.00337179", "asset" : "BNB"}, {"locked" : "0", "free" : "0", "asset" : "BTC"}, {"locked" : "0", "free" : "0", "asset" : "ETH"}, {"locked" : "0", "free" : "0", "asset" : "USDT"}, {"locked" : "0", "free" : "0", "asset" : "XRP"}, ], }, "type" : "spot", "updateTime" : 1630886399000, }, { "data" : { "totalAssetOfBtc" : "0.00003192", "balances" : [ {"locked" : "0", "free" : "0", "asset" : "ADA"}, {"locked" : "20.99", "free" : "0.00015", "asset" : "AR"}, {"locked" : "0", "free" : "0.00337179", "asset" : "BNB"}, {"locked" : "0", "free" : "0", "asset" : "BTC"}, {"locked" : "0", "free" : "0", "asset" : "ETH"}, {"locked" : "0", "free" : "0", "asset" : "USDT"}, {"locked" : "0", "free" : "0", "asset" : "XRP"}, ], }, "type" : "spot", "updateTime" : 1630972799000, }, { "data" : { "totalAssetOfBtc" : "0.00003024", "balances" : [ {"locked" : "0", "free" : "0", "asset" : "ADA"}, {"locked" : "20.99", "free" : "0.00015", "asset" : "AR"}, {"locked" : "0", "free" : "0.00337179", "asset" : "BNB"}, {"locked" : "0", "free" : "0", "asset" : "BTC"}, {"locked" : "0", "free" : "0", "asset" : "ETH"}, {"locked" : "0", "free" : "0", "asset" : "USDT"}, {"locked" : "0", "free" : "0", "asset" : "XRP"}, ], }, "type" : "spot", "updateTime" : 1631059199000, }, { "data" : { "totalAssetOfBtc" : "0.00003054", "balances" : [ {"locked" : "0", "free" : "0", "asset" : "ADA"}, {"locked" : "20.99", "free" : "0.00015", "asset" : "AR"}, {"locked" : "0", "free" : "0.00337179", "asset" : "BNB"}, {"locked" : "0", "free" : "0", "asset" : "BTC"}, {"locked" : "0", "free" : "0", "asset" : "ETH"}, {"locked" : "0", "free" : "0", "asset" : "USDT"}, {"locked" : "0", "free" : "0", "asset" : "XRP"}, ], }, "type" : "spot", "updateTime" : 1631145599000, }, { "data" : { "totalAssetOfBtc" : "0.0000212", "balances" : [ {"locked" : "0", "free" : "0", "asset" : "ADA"}, {"locked" : "0", "free" : "0.00766", "asset" : "AR"}, {"locked" : "0", "free" : "0.00092407", "asset" : "BNB"}, {"locked" : "0", "free" : "0", "asset" : "BTC"}, {"locked" : "0", "free" : "0", "asset" : "ETH"}, {"locked" : "1438.8", "free" : "0.0741648", "asset" : "USDT"}, {"locked" : "0", "free" : "0", "asset" : "XRP"}, ], }, "type" : "spot", "updateTime" : 1631231999000, }, { "data" : { "totalAssetOfBtc" : "0.00002055", "balances" : [ {"locked" : "0", "free" : "0", "asset" : "ADA"}, {"locked" : "0", "free" : "0.00766", "asset" : "AR"}, {"locked" : "0", "free" : "0.00092407", "asset" : "BNB"}, {"locked" : "0", "free" : "0", "asset" : "BTC"}, {"locked" : "0", "free" : "0", "asset" : "ETH"}, {"locked" : "1438.8", "free" : "0.0741648", "asset" : "USDT"}, {"locked" : "0", "free" : "0", "asset" : "XRP"}, ], }, "type" : "spot", "updateTime" : 1631318399000, }, { "data" : { "totalAssetOfBtc" : "0.00002032", "balances" : [ {"locked" : "0", "free" : "0", "asset" : "ADA"}, {"locked" : "0", "free" : "0.00766", "asset" : "AR"}, {"locked" : "0", "free" : "0.00092407", "asset" : "BNB"}, {"locked" : "0", "free" : "0", "asset" : "BTC"}, {"locked" : "0", "free" : "0", "asset" : "ETH"}, {"locked" : "1438.8", "free" : "0.0741648", "asset" : "USDT"}, {"locked" : "0", "free" : "0", "asset" : "XRP"}, ], }, "type" : "spot", "updateTime" : 1631404799000, }, { "data" : { "totalAssetOfBtc" : "0.03108823", "balances" : [ {"locked" : "0", "free" : "0", "asset" : "ADA"}, {"locked" : "0", "free" : "23.96368", "asset" : "AR"}, {"locked" : "0", "free" : "0.00092407", "asset" : "BNB"}, {"locked" : "0", "free" : "0", "asset" : "BTC"}, {"locked" : "0", "free" : "0", "asset" : "ETH"}, {"locked" : "0", "free" : "0.0741648", "asset" : "USDT"}, {"locked" : "0", "free" : "0", "asset" : "XRP"}, ], }, "type" : "spot", "updateTime" : 1631491199000, }, { "data" : { "totalAssetOfBtc" : "0.02890814", "balances" : [ {"locked" : "0", "free" : "0", "asset" : "ADA"}, {"locked" : "0", "free" : "23.96368", "asset" : "AR"}, {"locked" : "0", "free" : "0.00092407", "asset" : "BNB"}, {"locked" : "0", "free" : "0", "asset" : "BTC"}, {"locked" : "0", "free" : "0", "asset" : "ETH"}, {"locked" : "0", "free" : "0.0741648", "asset" : "USDT"}, {"locked" : "0", "free" : "0", "asset" : "XRP"}, ], }, "type" : "spot", "updateTime" : 1631577599000, }, { "data" : { "totalAssetOfBtc" : "0.02813346", "balances" : [ {"locked" : "0", "free" : "0", "asset" : "ADA"}, {"locked" : "0", "free" : "23.96368", "asset" : "AR"}, {"locked" : "0", "free" : "0.00092407", "asset" : "BNB"}, {"locked" : "0", "free" : "0", "asset" : "BTC"}, {"locked" : "0", "free" : "0", "asset" : "ETH"}, {"locked" : "0", "free" : "0.0741648", "asset" : "USDT"}, {"locked" : "0", "free" : "0", "asset" : "XRP"}, ], }, "type" : "spot", "updateTime" : 1631663999000, }, { "data" : { "totalAssetOfBtc" : "0.02882372", "balances" : [ {"locked" : "0", "free" : "0", "asset" : "ADA"}, {"locked" : "0", "free" : "23.96368", "asset" : "AR"}, {"locked" : "0", "free" : "0.00092407", "asset" : "BNB"}, {"locked" : "0", "free" : "0", "asset" : "BTC"}, {"locked" : "0", "free" : "0", "asset" : "ETH"}, {"locked" : "0", "free" : "0.0741648", "asset" : "USDT"}, {"locked" : "0", "free" : "0", "asset" : "XRP"}, ], }, "type" : "spot", "updateTime" : 1631750399000, }, { "data" : { "totalAssetOfBtc" : "0.02669617", "balances" : [ {"locked" : "0", "free" : "0", "asset" : "ADA"}, {"locked" : "0", "free" : "23.96368", "asset" : "AR"}, {"locked" : "0", "free" : "0.00092407", "asset" : "BNB"}, {"locked" : "0", "free" : "0", "asset" : "BTC"}, {"locked" : "0", "free" : "0", "asset" : "ETH"}, {"locked" : "0", "free" : "0.0741648", "asset" : "USDT"}, {"locked" : "0", "free" : "0", "asset" : "XRP"}, ], }, "type" : "spot", "updateTime" : 1631836799000, }, { "data" : { "totalAssetOfBtc" : "0.02491256", "balances" : [ {"locked" : "0", "free" : "0", "asset" : "ADA"}, {"locked" : "0", "free" : "23.96368", "asset" : "AR"}, {"locked" : "0", "free" : "0.00092407", "asset" : "BNB"}, {"locked" : "0", "free" : "0", "asset" : "BTC"}, {"locked" : "0", "free" : "0", "asset" : "ETH"}, {"locked" : "0", "free" : "0.0741648", "asset" : "USDT"}, {"locked" : "0", "free" : "0", "asset" : "XRP"}, ], }, "type" : "spot", "updateTime" : 1631923199000, }, { "data" : { "totalAssetOfBtc" : "0.02456859", "balances" : [ {"locked" : "0", "free" : "0", "asset" : "ADA"}, {"locked" : "0", "free" : "23.96368", "asset" : "AR"}, {"locked" : "0", "free" : "0.00092407", "asset" : "BNB"}, {"locked" : "0", "free" : "0", "asset" : "BTC"}, {"locked" : "0", "free" : "0", "asset" : "ETH"}, {"locked" : "0", "free" : "0.0741648", "asset" : "USDT"}, {"locked" : "0", "free" : "0", "asset" : "XRP"}, ], }, "type" : "spot", "updateTime" : 1632009599000, }, { "data" : { "totalAssetOfBtc" : "0.02465261", "balances" : [ {"locked" : "0", "free" : "0", "asset" : "ADA"}, {"locked" : "0", "free" : "23.96368", "asset" : "AR"}, {"locked" : "0", "free" : "0.00092407", "asset" : "BNB"}, {"locked" : "0", "free" : "0", "asset" : "BTC"}, {"locked" : "0", "free" : "0", "asset" : "ETH"}, {"locked" : "0", "free" : "0.0741648", "asset" : "USDT"}, {"locked" : "0", "free" : "0", "asset" : "XRP"}, ], }, "type" : "spot", "updateTime" : 1632095999000, }, { "data" : { "totalAssetOfBtc" : "0.0224611", "balances" : [ {"locked" : "0", "free" : "0", "asset" : "ADA"}, {"locked" : "0", "free" : "23.96368", "asset" : "AR"}, {"locked" : "0", "free" : "0.00092407", "asset" : "BNB"}, {"locked" : "0", "free" : "0", "asset" : "BTC"}, {"locked" : "0", "free" : "0", "asset" : "ETH"}, {"locked" : "0", "free" : "0.0741648", "asset" : "USDT"}, {"locked" : "0", "free" : "0", "asset" : "XRP"}, ], }, "type" : "spot", "updateTime" : 1632182399000, }, { "data" : { "totalAssetOfBtc" : "0.02180946", "balances" : [ {"locked" : "0", "free" : "0", "asset" : "ADA"}, {"locked" : "0", "free" : "23.96368", "asset" : "AR"}, {"locked" : "0", "free" : "0.00092407", "asset" : "BNB"}, {"locked" : "0", "free" : "0", "asset" : "BTC"}, {"locked" : "0", "free" : "0", "asset" : "ETH"}, {"locked" : "0", "free" : "0.0741648", "asset" : "USDT"}, {"locked" : "0", "free" : "0", "asset" : "XRP"}, ], }, "type" : "spot", "updateTime" : 1632268799000, }, { "data" : { "totalAssetOfBtc" : "0.0263156", "balances" : [ {"locked" : "0", "free" : "0", "asset" : "ADA"}, {"locked" : "0", "free" : "23.96368", "asset" : "AR"}, {"locked" : "0", "free" : "0.00092407", "asset" : "BNB"}, {"locked" : "0", "free" : "0", "asset" : "BTC"}, {"locked" : "0", "free" : "0", "asset" : "ETH"}, {"locked" : "0", "free" : "0.0741648", "asset" : "USDT"}, {"locked" : "0", "free" : "0", "asset" : "XRP"}, ], }, "type" : "spot", "updateTime" : 1632355199000, }, { "data" : { "totalAssetOfBtc" : "0.02801253", "balances" : [ {"locked" : "0", "free" : "0", "asset" : "ADA"}, {"locked" : "0", "free" : "23.96368", "asset" : "AR"}, {"locked" : "0", "free" : "0.00092407", "asset" : "BNB"}, {"locked" : "0", "free" : "0", "asset" : "BTC"}, {"locked" : "0", "free" : "0", "asset" : "ETH"}, {"locked" : "0", "free" : "0.0741648", "asset" : "USDT"}, {"locked" : "0", "free" : "0", "asset" : "XRP"}, ], }, "type" : "spot", "updateTime" : 1632441599000, }, { "data" : { "totalAssetOfBtc" : "0.02720411", "balances" : [ {"locked" : "0", "free" : "0", "asset" : "ADA"}, {"locked" : "0", "free" : "23.96368", "asset" : "AR"}, {"locked" : "0", "free" : "0.00092407", "asset" : "BNB"}, {"locked" : "0", "free" : "0", "asset" : "BTC"}, {"locked" : "0", "free" : "0", "asset" : "ETH"}, {"locked" : "0", "free" : "0.0741648", "asset" : "USDT"}, {"locked" : "0", "free" : "0", "asset" : "XRP"}, ], }, "type" : "spot", "updateTime" : 1632527999000, }, { "data" : { "totalAssetOfBtc" : "0.0252596", "balances" : [ {"locked" : "0", "free" : "0", "asset" : "ADA"}, {"locked" : "0", "free" : "23.96368", "asset" : "AR"}, {"locked" : "0", "free" : "0.00092407", "asset" : "BNB"}, {"locked" : "0", "free" : "0", "asset" : "BTC"}, {"locked" : "0", "free" : "0", "asset" : "ETH"}, {"locked" : "0", "free" : "0.0741648", "asset" : "USDT"}, {"locked" : "0", "free" : "0", "asset" : "XRP"}, ], }, "type" : "spot", "updateTime" : 1632614399000, }, { "data" : { "totalAssetOfBtc" : "0.02416231", "balances" : [ {"locked" : "0", "free" : "0", "asset" : "ADA"}, {"locked" : "0", "free" : "23.96368", "asset" : "AR"}, {"locked" : "0", "free" : "0.00092407", "asset" : "BNB"}, {"locked" : "0", "free" : "0", "asset" : "BTC"}, {"locked" : "0", "free" : "0", "asset" : "ETH"}, {"locked" : "0", "free" : "0.0741648", "asset" : "USDT"}, {"locked" : "0", "free" : "0", "asset" : "XRP"}, ], }, "type" : "spot", "updateTime" : 1632700799000, }, { "data" : { "totalAssetOfBtc" : "0.0231484", "balances" : [ {"locked" : "0", "free" : "0", "asset" : "ADA"}, {"locked" : "0", "free" : "23.96368", "asset" : "AR"}, {"locked" : "0", "free" : "0.00092407", "asset" : "BNB"}, {"locked" : "0", "free" : "0", "asset" : "BTC"}, {"locked" : "0", "free" : "0", "asset" : "ETH"}, {"locked" : "0", "free" : "0.0741648", "asset" : "USDT"}, {"locked" : "0", "free" : "0", "asset" : "XRP"}, ], }, "type" : "spot", "updateTime" : 1632787199000, }, { "data" : { "totalAssetOfBtc" : "0.02272228", "balances" : [ {"locked" : "0", "free" : "23.96368", "asset" : "AR"}, {"locked" : "0", "free" : "0.00092407", "asset" : "BNB"}, {"locked" : "0", "free" : "0", "asset" : "BTC"}, {"locked" : "0", "free" : "0", "asset" : "ETH"}, {"locked" : "0", "free" : "0.0741648", "asset" : "USDT"}, {"locked" : "0", "free" : "0", "asset" : "XRP"}, ], }, "type" : "spot", "updateTime" : 1632873599000, }, ], "code" : 200, }
set_env(prod=true)
as = account_status()
set_env()
pprint(as["data"])
{"data" : "Normal",}
set_env(prod=true)
ats = account_api_trading_status()
set_env()
pprint(ats)
{ "msg" : "", "success" : true, "data" : { "data" : { "plannedRecoverTime" : 0, "isLocked" : false, "triggerCondition" : {"UFR" : 300, "GCR" : 150, "IFER" : 150}, "updateTime" : 1632890683256, }, }, }
set_env(prod=true)
ad = asset_detail("AR") # asset_detail("")
set_env()
pprint(ad["data"])
{ "AR" : {"withdrawFee" : "0.03", "minWithdrawAmount" : "0.1", "withdrawStatus" : true, "depositStatus" : true}, }
set_env(prod=true) # 운영설정
df = trade_fee()["data"]
# df = trade_fee(symbol="ARUSDT")["data"]
set_env() # 테스트 설정
df
1,664 rows × 3 columns
makerCommission | symbol | takerCommission | |
---|---|---|---|
Float64 | String | Float64 | |
1 | 0.001 | 1INCHBTC | 0.001 |
2 | 0.0 | 1INCHBUSD | 0.001 |
3 | 0.001 | 1INCHDOWNUSDT | 0.001 |
4 | 0.001 | 1INCHUPUSDT | 0.001 |
5 | 0.001 | 1INCHUSDT | 0.001 |
6 | 0.001 | AAVEBKRW | 0.001 |
7 | 0.001 | AAVEBNB | 0.001 |
8 | 0.001 | AAVEBRL | 0.001 |
9 | 0.001 | AAVEBTC | 0.001 |
10 | 0.0 | AAVEBUSD | 0.001 |
⋮ | ⋮ | ⋮ | ⋮ |
filter(:symbol=> t -> occursin(r"^ETHUS.*", t) == true,df)
3 rows × 3 columns
makerCommission | symbol | takerCommission | |
---|---|---|---|
Float64 | String | Float64 | |
1 | 0.001 | ETHUSDC | 0.001 |
2 | 0.001 | ETHUSDP | 0.001 |
3 | 0.001 | ETHUSDT | 0.001 |
set_env(prod=true)
apikeyperm = apikey_permission()
set_env()
pprint(apikeyperm)
{ "msg" : "", "success" : true, "data" : {"tradingAuthorityExpirationTime" : 1633046400000, "enableMargin" : false, "ipRestrict" : false, "permitsUniversalTransfer" : false, "enableFutures" : false, "enableSpotAndMarginTrading" : true, "enableReading" : true, "enableInternalTransfer" : false, "createTime" : 1630492484000, "enableWithdrawals" : false, "enableVanillaOptions" : false}, }
let
set_env(prod=false)
acc = account()
set_env()
if !acc["success"]
return acc
end
pprint(acc["data"])
acc["data"]["balances"]
end
{ "buyerCommission" : 0, "sellerCommission" : 0, "updateTime" : 1632762974326, "accountType" : "SPOT", "updateTimeDtLocal" : Dates.DateTime( instant=Dates.UTInstant{Dates.Millisecond}( periods=Dates.Millisecond(value=63768446174326,), ), ), "canDeposit" : false, "canWithdraw" : false, "takerCommission" : 0, "permissions" : ["SPOT",], "makerCommission" : 0, "balances" : DataFrames.DataFrame( asset=["BNB", "BTC", "BUSD", "ETH", "LTC", "TRX", "USDT", "XRP"], free=[1000.0, 1.0, 10000.0, 100.04, 500.0, 500000.0, 9917.0068, 50000.0], locked=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], ), "canTrade" : true, }
8 rows × 3 columns
asset | free | locked | |
---|---|---|---|
String | Float64 | Float64 | |
1 | BNB | 1000.0 | 0.0 |
2 | BTC | 1.0 | 0.0 |
3 | BUSD | 10000.0 | 0.0 |
4 | ETH | 100.04 | 0.0 |
5 | LTC | 500.0 | 0.0 |
6 | TRX | 500000.0 | 0.0 |
7 | USDT | 9917.01 | 0.0 |
8 | XRP | 50000.0 | 0.0 |
let
b1 = balances()
if !b1["success"]
return b1
end
display(b1["data"])
b2 = balances(asset="USDT")
b2["data"]
# Base.delete_method(@which balances())
end
8 rows × 3 columns
asset | free | locked | |
---|---|---|---|
String | Float64 | Float64 | |
1 | BNB | 1000.0 | 0.0 |
2 | BTC | 1.0 | 0.0 |
3 | BUSD | 10000.0 | 0.0 |
4 | ETH | 100.04 | 0.0 |
5 | LTC | 500.0 | 0.0 |
6 | TRX | 500000.0 | 0.0 |
7 | USDT | 9917.01 | 0.0 |
8 | XRP | 50000.0 | 0.0 |
1 rows × 3 columns
asset | free | locked | |
---|---|---|---|
String | Float64 | Float64 | |
1 | USDT | 9917.01 | 0.0 |
symbol = "BTCUSDT"
sob = symbol_orderbook_ticker(symbol)
display(sob["data"])
price = sob["data"][1,:bidPrice]
price = price*0.23
# price = 4343.1199
order_amount = 12
pprint(make_order_price_qty(symbol,price,order_amount))
# Base.delete_method(@which make_order_price_qty(symbol,price,order_amount) )
1 rows × 5 columns
askPrice | askQty | bidPrice | bidQty | symbol | |
---|---|---|---|---|---|
Float64 | Float64 | Float64 | Float64 | String | |
1 | 42322.5 | 0.011815 | 42320.8 | 0.009815 | BTCUSDT |
{ "msg" : "", "success" : true, "data" : {"balance" : 9917.0068, "price" : 9733.79, "totalAmount" : 11.99202928, "maxQty" : 900.0, "symbol" : "BTCUSDT", "minOrderAmount" : 10.0, "qty" : 0.001232, "minPrice" : 0.01, "maxPrice" : 1.0e6, "minQty" : 1.0e-6, "avrPrice" : 42283.52259518}, }
set_env(prod=true)
# set_env()
d = all_orders("ARUSDT")
set_env()
d["data"]
21 rows × 20 columns
clientOrderId | cummulativeQuoteQty | executedQty | icebergQty | isWorking | orderId | orderListId | origQty | origQuoteOrderQty | price | side | status | stopPrice | symbol | time | timeInForce | type | updateTime | timeDtLocal | updateTimeDtLocal | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
String | Float64 | Float64 | Float64 | Bool | Int64 | Int64 | Float64 | Float64 | Float64 | String | String | Float64 | String | Int64 | String | String | Int64 | DateTim… | DateTim… | |
1 | web_702a52a1fcc04219b388fea46bc325a7 | 1438.8 | 23.98 | 0.0 | 1 | 65840582 | -1 | 23.98 | 0.0 | 60.0 | BUY | FILLED | 0.0 | ARUSDT | 1631433447186 | GTC | LIMIT | 1631433989716 | 2021-09-12T16:57:27.186 | 2021-09-12T17:06:29.716 |
2 | and_e2c042bd5ea64a7897a408dde2209aa2 | 0.0 | 0.0 | 0.0 | 1 | 64289669 | -1 | 26.16 | 0.0 | 55.0 | BUY | CANCELED | 0.0 | ARUSDT | 1631284289968 | GTC | LIMIT | 1631433419361 | 2021-09-10T23:31:29.968 | 2021-09-12T16:56:59.361 |
3 | and_1b918f119ec241b9b258ede3919e60a4 | 0.0 | 0.0 | 0.0 | 1 | 62238503 | -1 | 23.98 | 0.0 | 60.0 | BUY | CANCELED | 0.0 | ARUSDT | 1631200133602 | GTC | LIMIT | 1631284274047 | 2021-09-10T00:08:53.602 | 2021-09-10T23:31:14.047 |
4 | and_96b183a43b294e25a2ac4db5e426b13c | 1440.14 | 22.46 | 0.0 | 1 | 62206264 | -1 | 22.46 | 0.0 | 64.12 | SELL | FILLED | 0.0 | ARUSDT | 1631197604249 | GTC | LIMIT | 1631200042755 | 2021-09-09T23:26:44.249 | 2021-09-10T00:07:22.755 |
5 | web_ced66a58022e4de2904046861ad57e33 | 1349.4 | 22.49 | 0.0 | 1 | 62190963 | -1 | 22.49 | 0.0 | 60.0 | BUY | FILLED | 0.0 | ARUSDT | 1631196527113 | GTC | LIMIT | 1631197414761 | 2021-09-09T23:08:47.113 | 2021-09-09T23:23:34.761 |
6 | and_64225e76ad7e40a79641331349b4c54b | 0.0 | 0.0 | 0.0 | 1 | 61139363 | -1 | 26.99 | 0.0 | 50.0 | BUY | CANCELED | 0.0 | ARUSDT | 1631152869629 | GTC | LIMIT | 1631196511432 | 2021-09-09T11:01:09.629 | 2021-09-09T23:08:31.432 |
7 | and_901a624334644e76b6f1666cb88d77c2 | 1349.58 | 20.99 | 0.0 | 1 | 61129000 | -1 | 20.99 | 0.0 | 0.0 | SELL | FILLED | 0.0 | ARUSDT | 1631152689969 | GTC | MARKET | 1631152689969 | 2021-09-09T10:58:09.969 | 2021-09-09T10:58:09.969 |
8 | and_cc7c5ebc3f534a76882564809c970987 | 0.0 | 0.0 | 0.0 | 1 | 54176177 | -1 | 20.99 | 0.0 | 72.0 | SELL | CANCELED | 0.0 | ARUSDT | 1630536478029 | GTC | LIMIT | 1631152641459 | 2021-09-02T07:47:58.029 | 2021-09-09T10:57:21.459 |
9 | and_52e3490373644d06aa3172ce0ae5e057 | 0.0 | 0.0 | 0.0 | 1 | 53422039 | -1 | 20.99 | 0.0 | 66.3 | SELL | CANCELED | 0.0 | ARUSDT | 1630482561808 | GTC | LIMIT | 1630536323989 | 2021-09-01T16:49:21.808 | 2021-09-02T07:45:23.989 |
10 | and_1da44fd45c93400ca6774e3689bde64a | 1313.11 | 21.01 | 0.0 | 1 | 53418208 | -1 | 21.01 | 1313.57 | 0.0 | BUY | FILLED | 0.0 | ARUSDT | 1630482399610 | GTC | MARKET | 1630482399610 | 2021-09-01T16:46:39.610 | 2021-09-01T16:46:39.610 |
⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ |
set_env(prod=true)
# set_env()
d = query_orders("ARUSDT",orderid=39925351)
set_env()
d["data"]
1 rows × 20 columns
clientOrderId | cummulativeQuoteQty | executedQty | icebergQty | isWorking | orderId | orderListId | origQty | origQuoteOrderQty | price | side | status | stopPrice | symbol | time | timeInForce | type | updateTime | timeDtLocal | updateTimeDtLocal | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
String | Float64 | Float64 | Float64 | Bool | Int64 | Int64 | Float64 | Float64 | Float64 | String | String | Float64 | String | Int64 | String | String | Int64 | DateTim… | DateTim… | |
1 | and_82d01909c3d74475bbc427ef9c84a820 | 1268.64 | 44.31 | 0.0 | 1 | 39925351 | -1 | 44.31 | 0.0 | 28.631 | BUY | FILLED | 0.0 | ARUSDT | 1629383051400 | GTC | LIMIT | 1629383087544 | 2021-08-19T23:24:11.400 | 2021-08-19T23:24:47.544 |
query_orders("ETHUSDT";orderid=773)["data"]
1 rows × 20 columns
clientOrderId | cummulativeQuoteQty | executedQty | icebergQty | isWorking | orderId | orderListId | origQty | origQuoteOrderQty | price | side | status | stopPrice | symbol | time | timeInForce | type | updateTime | timeDtLocal | updateTimeDtLocal | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
String | Float64 | Float64 | Float64 | Bool | Int64 | Int64 | Float64 | Float64 | Float64 | String | String | Float64 | String | Int64 | String | String | Int64 | DateTim… | DateTim… | |
1 | fIweNwsKxlvpno1K19mruh | 20.0 | 0.01 | 0.0 | 1 | 773 | -1 | 0.01 | 0.0 | 2000.0 | BUY | FILLED | 0.0 | ETHUSDT | 1630916304367 | GTC | LIMIT | 1630916473798 | 2021-09-06T17:18:24.367 | 2021-09-06T17:21:13.798 |
set_env(prod=true)
allorders = all_orders("ARUSDT")
#pprint(allorders)
set_env()
allorders["data"]
21 rows × 20 columns
clientOrderId | cummulativeQuoteQty | executedQty | icebergQty | isWorking | orderId | orderListId | origQty | origQuoteOrderQty | price | side | status | stopPrice | symbol | time | timeInForce | type | updateTime | timeDtLocal | updateTimeDtLocal | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
String | Float64 | Float64 | Float64 | Bool | Int64 | Int64 | Float64 | Float64 | Float64 | String | String | Float64 | String | Int64 | String | String | Int64 | DateTim… | DateTim… | |
1 | web_702a52a1fcc04219b388fea46bc325a7 | 1438.8 | 23.98 | 0.0 | 1 | 65840582 | -1 | 23.98 | 0.0 | 60.0 | BUY | FILLED | 0.0 | ARUSDT | 1631433447186 | GTC | LIMIT | 1631433989716 | 2021-09-12T16:57:27.186 | 2021-09-12T17:06:29.716 |
2 | and_e2c042bd5ea64a7897a408dde2209aa2 | 0.0 | 0.0 | 0.0 | 1 | 64289669 | -1 | 26.16 | 0.0 | 55.0 | BUY | CANCELED | 0.0 | ARUSDT | 1631284289968 | GTC | LIMIT | 1631433419361 | 2021-09-10T23:31:29.968 | 2021-09-12T16:56:59.361 |
3 | and_1b918f119ec241b9b258ede3919e60a4 | 0.0 | 0.0 | 0.0 | 1 | 62238503 | -1 | 23.98 | 0.0 | 60.0 | BUY | CANCELED | 0.0 | ARUSDT | 1631200133602 | GTC | LIMIT | 1631284274047 | 2021-09-10T00:08:53.602 | 2021-09-10T23:31:14.047 |
4 | and_96b183a43b294e25a2ac4db5e426b13c | 1440.14 | 22.46 | 0.0 | 1 | 62206264 | -1 | 22.46 | 0.0 | 64.12 | SELL | FILLED | 0.0 | ARUSDT | 1631197604249 | GTC | LIMIT | 1631200042755 | 2021-09-09T23:26:44.249 | 2021-09-10T00:07:22.755 |
5 | web_ced66a58022e4de2904046861ad57e33 | 1349.4 | 22.49 | 0.0 | 1 | 62190963 | -1 | 22.49 | 0.0 | 60.0 | BUY | FILLED | 0.0 | ARUSDT | 1631196527113 | GTC | LIMIT | 1631197414761 | 2021-09-09T23:08:47.113 | 2021-09-09T23:23:34.761 |
6 | and_64225e76ad7e40a79641331349b4c54b | 0.0 | 0.0 | 0.0 | 1 | 61139363 | -1 | 26.99 | 0.0 | 50.0 | BUY | CANCELED | 0.0 | ARUSDT | 1631152869629 | GTC | LIMIT | 1631196511432 | 2021-09-09T11:01:09.629 | 2021-09-09T23:08:31.432 |
7 | and_901a624334644e76b6f1666cb88d77c2 | 1349.58 | 20.99 | 0.0 | 1 | 61129000 | -1 | 20.99 | 0.0 | 0.0 | SELL | FILLED | 0.0 | ARUSDT | 1631152689969 | GTC | MARKET | 1631152689969 | 2021-09-09T10:58:09.969 | 2021-09-09T10:58:09.969 |
8 | and_cc7c5ebc3f534a76882564809c970987 | 0.0 | 0.0 | 0.0 | 1 | 54176177 | -1 | 20.99 | 0.0 | 72.0 | SELL | CANCELED | 0.0 | ARUSDT | 1630536478029 | GTC | LIMIT | 1631152641459 | 2021-09-02T07:47:58.029 | 2021-09-09T10:57:21.459 |
9 | and_52e3490373644d06aa3172ce0ae5e057 | 0.0 | 0.0 | 0.0 | 1 | 53422039 | -1 | 20.99 | 0.0 | 66.3 | SELL | CANCELED | 0.0 | ARUSDT | 1630482561808 | GTC | LIMIT | 1630536323989 | 2021-09-01T16:49:21.808 | 2021-09-02T07:45:23.989 |
10 | and_1da44fd45c93400ca6774e3689bde64a | 1313.11 | 21.01 | 0.0 | 1 | 53418208 | -1 | 21.01 | 1313.57 | 0.0 | BUY | FILLED | 0.0 | ARUSDT | 1630482399610 | GTC | MARKET | 1630482399610 | 2021-09-01T16:46:39.610 | 2021-09-01T16:46:39.610 |
⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ |
Make PriceQty / Create / Execute / Cancell All
let
set_env()
symbol = "BTCUSDT"
# symbol = "LTCUSDT"
sob = symbol_orderbook_ticker(symbol)
price = sob["data"][1,:bidPrice]
price = price*0.21
# price = 24343.11
order_amount = 11
opq = make_order_price_qty(symbol,price,order_amount)
if !opq["success"]
return opq
end
println("====== Make Price/Qty ========")
pprint(opq["data"])
price = opq["data"]["price"]
qty = opq["data"]["qty"]
println("")
pprint("====== ORDER 1 ========")
println("")
order = create_order(symbol,"BUY";
quantity=qty,order_type="LIMIT",price=price)
pprint(order)
ex_order = execute_order(order["data"];execute=true)
pprint(ex_order)
println("")
pprint("====== ORDER 2 ========")
println("")
order = create_order(symbol,"BUY";
quantity=qty,order_type="LIMIT",price=price)
pprint(order)
ex_order = execute_order(order["data"];execute=true)
pprint(ex_order)
println("")
pprint("====== CURRENT ORDERS ========")
println("")
display(current_open_orders()["data"])
println("")
pprint("====== CANCEL ALL ORDERS ========")
println("")
cao = cancel_all_orders(symbol)
set_env()
display(cao)
if cao["success"]
display(cao["data"]["orders"])
display(cao["data"]["orders_oco"])
end
end
====== Make Price/Qty ======== {"balance" : 9917.0068, "price" : 8887.37, "totalAmount" : 10.99367669, "maxQty" : 900.0, "symbol" : "BTCUSDT", "minOrderAmount" : 10.0, "qty" : 0.001237, "minPrice" : 0.01, "maxPrice" : 1.0e6, "minQty" : 1.0e-6, "avrPrice" : 42283.25960657} "====== ORDER 1 ========" { "msg" : "", "success" : true, "data" : {"price" : "8887.37000000", "timeInForce" : "GTC", "side" : "BUY", "newOrderRespType" : "FULL", "symbol" : "BTCUSDT", "recvWindow" : 10000, "type" : "LIMIT", "quantity" : "0.00123700"}, }{ "msg" : "", "success" : true, "data" : { "price" : "8887.37000000", "timeInForce" : "GTC", "orderId" : 7403383, "executedQty" : "0.00000000", "clientOrderId" : "QTFeeslZgMrkdtd4zUjGSM", "orderListId" : -1, "status" : "NEW", "fills" : [], "transactTime" : 1632890690904, "symbol" : "BTCUSDT", "cummulativeQuoteQty" : "0.00000000", "origQty" : "0.00123700", "side" : "BUY", "type" : "LIMIT", }, } "====== ORDER 2 ========" { "msg" : "", "success" : true, "data" : {"price" : "8887.37000000", "timeInForce" : "GTC", "side" : "BUY", "newOrderRespType" : "FULL", "symbol" : "BTCUSDT", "recvWindow" : 10000, "type" : "LIMIT", "quantity" : "0.00123700"}, }{ "msg" : "", "success" : true, "data" : { "price" : "8887.37000000", "timeInForce" : "GTC", "orderId" : 7403384, "executedQty" : "0.00000000", "clientOrderId" : "9AUePRfA6zVmtph83ADmni", "orderListId" : -1, "status" : "NEW", "fills" : [], "transactTime" : 1632890691052, "symbol" : "BTCUSDT", "cummulativeQuoteQty" : "0.00000000", "origQty" : "0.00123700", "side" : "BUY", "type" : "LIMIT", }, } "====== CURRENT ORDERS ========"
2 rows × 20 columns
clientOrderId | cummulativeQuoteQty | executedQty | icebergQty | isWorking | orderId | orderListId | origQty | origQuoteOrderQty | price | side | status | stopPrice | symbol | time | timeInForce | type | updateTime | timeDtLocal | updateTimeDtLocal | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
String | Float64 | Float64 | Float64 | Bool | Int64 | Int64 | Float64 | Float64 | Float64 | String | String | Float64 | String | Int64 | String | String | Int64 | DateTim… | DateTim… | |
1 | QTFeeslZgMrkdtd4zUjGSM | 0.0 | 0.0 | 0.0 | 1 | 7403383 | -1 | 0.001237 | 0.0 | 8887.37 | BUY | NEW | 0.0 | BTCUSDT | 1632890690904 | GTC | LIMIT | 1632890690904 | 2021-09-29T13:44:50.904 | 2021-09-29T13:44:50.904 |
2 | 9AUePRfA6zVmtph83ADmni | 0.0 | 0.0 | 0.0 | 1 | 7403384 | -1 | 0.001237 | 0.0 | 8887.37 | BUY | NEW | 0.0 | BTCUSDT | 1632890691052 | GTC | LIMIT | 1632890691052 | 2021-09-29T13:44:51.052 | 2021-09-29T13:44:51.052 |
"====== CANCEL ALL ORDERS ========"
Dict{String, Any} with 3 entries:
"msg" => ""
"success" => true
"data" => Dict{String, Any}("orders"=>2×13 DataFrame…
2 rows × 13 columns
clientOrderId | cummulativeQuoteQty | executedQty | orderId | orderListId | origClientOrderId | origQty | price | side | status | symbol | timeInForce | type | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
String | String | String | Int64 | Int64 | String | String | String | String | String | String | String | String | |
1 | JLBFLAhaES1GAjuR2EkLaB | 0.00000000 | 0.00000000 | 7403383 | -1 | QTFeeslZgMrkdtd4zUjGSM | 0.00123700 | 8887.37000000 | BUY | CANCELED | BTCUSDT | GTC | LIMIT |
2 | JLBFLAhaES1GAjuR2EkLaB | 0.00000000 | 0.00000000 | 7403384 | -1 | 9AUePRfA6zVmtph83ADmni | 0.00123700 | 8887.37000000 | BUY | CANCELED | BTCUSDT | GTC | LIMIT |
nothing
let
set_env()
symbol = "ETHUSDT"
# symbol = "LTCUSDT"
sob = symbol_orderbook_ticker(symbol)
if !sob["success"]
return sob
end
price = sob["data"][1,:askPrice]
price = price*0.8
order_amount = 0 # 최소금액
opq = make_order_price_qty(symbol,price,order_amount)
if !opq["success"]
return opq
end
println("====== Make Price/Qty ========")
pprint(opq["data"])
price = opq["data"]["price"]
qty = opq["data"]["qty"]
println("")
println("====== ORDER $(symbol) ========")
println("")
order = create_order(symbol,"BUY";
quantity=qty,order_type="LIMIT",price=price)
if !order["success"]
return order
end
pprint(order["data"])
ex_order = execute_order(order["data"];execute=true)
if !ex_order["success"]
return ex_order
end
pprint(ex_order["data"])
orderid=ex_order["data"]["orderId"]
@show orderid
println("====== Cancel ========")
cancel = cancel_order(symbol,orderid=orderid)
if !cancel["success"]
return cancel
end
pprint(cancel["data"])
end
====== Make Price/Qty ======== {"balance" : 9917.0068, "price" : 654.28, "totalAmount" : 10.0039412, "maxQty" : 9000.0, "symbol" : "ETHUSDT", "minOrderAmount" : 10.0, "qty" : 0.01529, "minPrice" : 0.01, "maxPrice" : 100000.0, "minQty" : 1.0e-5, "avrPrice" : 185.65373758} ====== ORDER ETHUSDT ======== {"price" : "654.28000000", "timeInForce" : "GTC", "side" : "BUY", "newOrderRespType" : "FULL", "symbol" : "ETHUSDT", "recvWindow" : 10000, "type" : "LIMIT", "quantity" : "0.01529000"}{ "price" : "654.28000000", "timeInForce" : "GTC", "orderId" : 53556, "executedQty" : "0.00000000", "clientOrderId" : "emYRbYvFl3CrDpNO9b9V1q", "orderListId" : -1, "status" : "NEW", "fills" : [], "transactTime" : 1632890693138, "symbol" : "ETHUSDT", "cummulativeQuoteQty" : "0.00000000", "origQty" : "0.01529000", "side" : "BUY", "type" : "LIMIT", }orderid = 53556 ====== Cancel ======== {"price" : "654.28000000", "timeInForce" : "GTC", "orderId" : 53556, "executedQty" : "0.00000000", "clientOrderId" : "F8mbTVzWKyjzcEj1A4XoE5", "orderListId" : -1, "status" : "CANCELED", "origClientOrderId" : "emYRbYvFl3CrDpNO9b9V1q", "symbol" : "ETHUSDT", "cummulativeQuoteQty" : "0.00000000", "origQty" : "0.01529000", "side" : "BUY", "type" : "LIMIT"}
let
set_env(prod=true)
d = all_orders("ARUSDT")
set_env()
d["data"][1:5,:]
end
5 rows × 20 columns
clientOrderId | cummulativeQuoteQty | executedQty | icebergQty | isWorking | orderId | orderListId | origQty | origQuoteOrderQty | price | side | status | stopPrice | symbol | time | timeInForce | type | updateTime | timeDtLocal | updateTimeDtLocal | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
String | Float64 | Float64 | Float64 | Bool | Int64 | Int64 | Float64 | Float64 | Float64 | String | String | Float64 | String | Int64 | String | String | Int64 | DateTim… | DateTim… | |
1 | web_702a52a1fcc04219b388fea46bc325a7 | 1438.8 | 23.98 | 0.0 | 1 | 65840582 | -1 | 23.98 | 0.0 | 60.0 | BUY | FILLED | 0.0 | ARUSDT | 1631433447186 | GTC | LIMIT | 1631433989716 | 2021-09-12T16:57:27.186 | 2021-09-12T17:06:29.716 |
2 | and_e2c042bd5ea64a7897a408dde2209aa2 | 0.0 | 0.0 | 0.0 | 1 | 64289669 | -1 | 26.16 | 0.0 | 55.0 | BUY | CANCELED | 0.0 | ARUSDT | 1631284289968 | GTC | LIMIT | 1631433419361 | 2021-09-10T23:31:29.968 | 2021-09-12T16:56:59.361 |
3 | and_1b918f119ec241b9b258ede3919e60a4 | 0.0 | 0.0 | 0.0 | 1 | 62238503 | -1 | 23.98 | 0.0 | 60.0 | BUY | CANCELED | 0.0 | ARUSDT | 1631200133602 | GTC | LIMIT | 1631284274047 | 2021-09-10T00:08:53.602 | 2021-09-10T23:31:14.047 |
4 | and_96b183a43b294e25a2ac4db5e426b13c | 1440.14 | 22.46 | 0.0 | 1 | 62206264 | -1 | 22.46 | 0.0 | 64.12 | SELL | FILLED | 0.0 | ARUSDT | 1631197604249 | GTC | LIMIT | 1631200042755 | 2021-09-09T23:26:44.249 | 2021-09-10T00:07:22.755 |
5 | web_ced66a58022e4de2904046861ad57e33 | 1349.4 | 22.49 | 0.0 | 1 | 62190963 | -1 | 22.49 | 0.0 | 60.0 | BUY | FILLED | 0.0 | ARUSDT | 1631196527113 | GTC | LIMIT | 1631197414761 | 2021-09-09T23:08:47.113 | 2021-09-09T23:23:34.761 |
let
set_env(prod=true)
atl = account_trade_list("ARUSDT")
set_env()
if atl["success"]
atl["data"]
end
end
40 rows × 14 columns
commission | commissionAsset | id | isBestMatch | isBuyer | isMaker | orderId | orderListId | price | qty | quoteQty | symbol | time | timeDtLocal | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Float64 | String | Int64 | Bool | Bool | Bool | Int64 | Int64 | Float64 | Float64 | Float64 | String | Int64 | DateTim… | |
1 | 0.02398 | AR | 9400348 | 1 | 1 | 1 | 65840582 | -1 | 60.0 | 23.98 | 1438.8 | ARUSDT | 1631433989716 | 2021-09-12T17:06:29.716 |
2 | 1.44014 | USDT | 8602013 | 1 | 0 | 1 | 62206264 | -1 | 64.12 | 22.46 | 1440.14 | ARUSDT | 1631200042755 | 2021-09-10T00:07:22.755 |
3 | 0.02249 | AR | 8590762 | 1 | 1 | 1 | 62190963 | -1 | 60.0 | 22.49 | 1349.4 | ARUSDT | 1631197414761 | 2021-09-09T23:23:34.761 |
4 | 0.00057855 | BNB | 8341542 | 1 | 0 | 0 | 61129000 | -1 | 64.31 | 4.96 | 318.978 | ARUSDT | 1631152689969 | 2021-09-09T10:58:09.969 |
5 | 4.315e-5 | BNB | 8341543 | 1 | 0 | 0 | 61129000 | -1 | 64.31 | 0.37 | 23.7947 | ARUSDT | 1631152689969 | 2021-09-09T10:58:09.969 |
6 | 4.082e-5 | BNB | 8341544 | 1 | 0 | 0 | 61129000 | -1 | 64.31 | 0.35 | 22.5085 | ARUSDT | 1631152689969 | 2021-09-09T10:58:09.969 |
7 | 3.732e-5 | BNB | 8341545 | 1 | 0 | 0 | 61129000 | -1 | 64.31 | 0.32 | 20.5792 | ARUSDT | 1631152689969 | 2021-09-09T10:58:09.969 |
8 | 5.364e-5 | BNB | 8341546 | 1 | 0 | 0 | 61129000 | -1 | 64.3 | 0.46 | 29.578 | ARUSDT | 1631152689969 | 2021-09-09T10:58:09.969 |
9 | 8.63e-5 | BNB | 8341547 | 1 | 0 | 0 | 61129000 | -1 | 64.3 | 0.74 | 47.582 | ARUSDT | 1631152689969 | 2021-09-09T10:58:09.969 |
10 | 5.363e-5 | BNB | 8341548 | 1 | 0 | 0 | 61129000 | -1 | 64.29 | 0.46 | 29.5734 | ARUSDT | 1631152689969 | 2021-09-09T10:58:09.969 |
⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ |
recent_trades_list("XRPUSDT",limit=1)["data"]
1 rows × 8 columns
id | isBestMatch | isBuyerMaker | price | qty | quoteQty | time | timeDtLocal | |
---|---|---|---|---|---|---|---|---|
Int64 | Bool | Bool | Float64 | Float64 | Float64 | Int64 | DateTim… | |
1 | 4150 | 1 | 1 | 0.9226 | 270.8 | 249.84 | 1632889211026 | 2021-09-29T13:20:11.026 |
symbol = "XRPUSDT"
let
sob = symbol_orderbook_ticker(symbol)
display(sob["data"])
cap = current_avg_price(symbol)["data"]
display(cap)
rtl = recent_trades_list(symbol,limit=1)["data"]
display(rtl)
end
1 rows × 5 columns
askPrice | askQty | bidPrice | bidQty | symbol | |
---|---|---|---|---|---|
Float64 | Float64 | Float64 | Float64 | String | |
1 | 1.0252 | 44015.6 | 0.0 | 0.0 | XRPUSDT |
1 rows × 2 columns
mins | price | |
---|---|---|
Int64 | Float64 | |
1 | 5 | 0.995536 |
1 rows × 8 columns
id | isBestMatch | isBuyerMaker | price | qty | quoteQty | time | timeDtLocal | |
---|---|---|---|---|---|---|---|---|
Int64 | Bool | Bool | Float64 | Float64 | Float64 | Int64 | DateTim… | |
1 | 4150 | 1 | 1 | 0.9226 | 270.8 | 249.84 | 1632889211026 | 2021-09-29T13:20:11.026 |
let
ENV["LINES"] = 100
oco_order = create_oco_order(symbol,"BUY",0.7895,1.10,1.20,100)
# oco_order = create_oco_order("XRPUSDT","BUY",0.118940596,0.128940596,0.138940596,1000)
pprint(oco_order)
if !oco_order["success"]
return oco_order
end
ex_order = execute_oco_order(oco_order["data"],execute=true)
if !ex_order["success"]
return ex_order
end
exinfo = ex_order["data"]
display(exinfo)
display(pop!(exinfo,"orders"))
display(pop!(exinfo,"orderReports"))
ENV["LINES"] = 10
end
{ "msg" : "", "success" : true, "data" : {"stopPrice" : 1.1, "price" : 0.7895, "side" : "BUY", "symbol" : "XRPUSDT", "stopLimitPrice" : 1.2, "quantity" : 100.0, "stopLimitTimeInForce" : "GTC"}, }
Dict{String, Any} with 9 entries: "orders" => 2×3 DataFrame… "orderListId" => 18864 "contingencyType" => "OCO" "listClientOrderId" => "RD90yzp8xaULaSOPCzF5uA" "listStatusType" => "EXEC_STARTED" "symbol" => "XRPUSDT" "transactionTime" => 1632890695570 "listOrderStatus" => "EXECUTING" "orderReports" => 2×14 DataFrame…
2 rows × 3 columns
clientOrderId | orderId | symbol | |
---|---|---|---|
String | Int64 | String | |
1 | wS2oXSpQtuaMNB6eG6BzHr | 53935 | XRPUSDT |
2 | gRis88lY7J5SEKziHGvxK6 | 53936 | XRPUSDT |
2 rows × 14 columns
clientOrderId | cummulativeQuoteQty | executedQty | orderId | orderListId | origQty | price | side | status | stopPrice | symbol | timeInForce | transactTime | type | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
String | String | String | Int64 | Int64 | String | String | String | String | String? | String | String | Int64 | String | |
1 | wS2oXSpQtuaMNB6eG6BzHr | 0.00000000 | 0.00000000 | 53935 | 18864 | 100.00000000 | 1.20000000 | BUY | NEW | 1.10000000 | XRPUSDT | GTC | 1632890695570 | STOP_LOSS_LIMIT |
2 | gRis88lY7J5SEKziHGvxK6 | 0.00000000 | 0.00000000 | 53936 | 18864 | 100.00000000 | 0.78950000 | BUY | NEW | missing | XRPUSDT | GTC | 1632890695570 | LIMIT_MAKER |
10
let
ENV["LINES"] = 100
display(balances(asset="USDT")["data"])
ca = cancel_all_orders(symbol)
if !ca["success"]
return ca
end
display(ca["data"])
display(ca["data"]["orders_oco"])
display(balances(asset="USDT")["data"])
ENV["LINES"] = 10
end
1 rows × 3 columns
asset | free | locked | |
---|---|---|---|
String | Float64 | Float64 | |
1 | USDT | 9797.01 | 120.0 |
Dict{String, Any} with 2 entries:
"orders" => nothing
"orders_oco" => 2×14 DataFrame…
2 rows × 14 columns
clientOrderId | cummulativeQuoteQty | executedQty | orderId | orderListId | origClientOrderId | origQty | price | side | status | stopPrice | symbol | timeInForce | type | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
String | String | String | Int64 | Int64 | String | String | String | String | String | String? | String | String | String | |
1 | mT1S1OuWKySduyjdKizw0O | 0.00000000 | 0.00000000 | 53935 | 18864 | wS2oXSpQtuaMNB6eG6BzHr | 100.00000000 | 1.20000000 | BUY | CANCELED | 1.10000000 | XRPUSDT | GTC | STOP_LOSS_LIMIT |
2 | mT1S1OuWKySduyjdKizw0O | 0.00000000 | 0.00000000 | 53936 | 18864 | gRis88lY7J5SEKziHGvxK6 | 100.00000000 | 0.78950000 | BUY | CANCELED | missing | XRPUSDT | GTC | LIMIT_MAKER |
1 rows × 3 columns
asset | free | locked | |
---|---|---|---|
String | Float64 | Float64 | |
1 | USDT | 9797.01 | 120.0 |
10
rtl = recent_trades_list("XRPUSDT",limit=1)
rtl["data"]
1 rows × 8 columns
id | isBestMatch | isBuyerMaker | price | qty | quoteQty | time | timeDtLocal | |
---|---|---|---|---|---|---|---|---|
Int64 | Bool | Bool | Float64 | Float64 | Float64 | Int64 | DateTim… | |
1 | 4150 | 1 | 1 | 0.9226 | 270.8 | 249.84 | 1632889211026 | 2021-09-29T13:20:11.026 |
set_env(prod=true)
cdd = candlestick_data("ARUSDT",interval="15m",limit=200)
set_env()
cb = cdd["data"]
@show size(cb)
ohlc = select(cb,
:tDtLocal, :o,:h,:l,:c,copycols=false)
rename!(ohlc,:tDtLocal=>:t,
:o=>:Open,:h=>:High,:l=>:Low,:c=>:Close)
ts = TimeSeries.TimeArray(ohlc,timestamp = :t)
Plots.plot(ts, seriestype = :candlestick,xrotation = 60,
xtickfont=Plots.font(8),xticks = 10 )
size(cb) = (200, 14)