BotVS开发基础—2.1 账户、行情、K线、深度
生活随笔
收集整理的這篇文章主要介紹了
BotVS开发基础—2.1 账户、行情、K线、深度
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
代碼
import json def main():Log("賬號(hào)信息:", exchange.GetAccount()); # Log("K 線數(shù)據(jù):", exchange.GetRecords()); # 獲取K線數(shù)據(jù),已成交的記錄Log("行情數(shù)據(jù):", exchange.GetTicker()); # 返回行情數(shù)據(jù),未成交的掛單Log("深度數(shù)據(jù):", exchange.GetDepth()); # 返回市場(chǎng)深度數(shù)據(jù) depth = exchanges[0].GetDepth(); # 獲取市場(chǎng)深度Log("depth:", depth); # 日志輸出顯示Log(exchanges[0].GetAccount()); # 輸出 吃單前的 賬戶信息buyPrice = depth.Asks[0].Price; # 設(shè)置吃賣單的價(jià)格,即賣一,# 有時(shí)為確保吃單成功,這樣處理:var buyPrice = depth.Asks[0].Price + slidePrice;buyAmount = depth.Asks[0].Amount; # 吃賣單的量exchanges[0].Buy(buyPrice, buyAmount); # 執(zhí)行買入操作, 吃掉賣一 這個(gè)單子Log(exchanges[0].GetAccount()); # 顯示買入后的 賬戶信息,對(duì)比初始賬戶信息??梢詫?duì)比出 買入操作的成交的數(shù)量。返回
賬號(hào)信息: {'Balance': 1000000.0, 'Stocks': 3.0, 'FrozenBalance': 0.0, 'FrozenStocks': 0.0}K 線數(shù)據(jù) [{"Volume":50.980000000000004,"High":17997,"Low":17961,"Time":1498823400000,"Close":17996,"Open":17961},{"Volume":7.89,"High":17990,"Low":17958,"Time":1498823700000,"Close":17958,"Open":17990},{"Volume":11.03,"High":17969.63,"Low":17950,"Time":1498824000000,"Close":17950,"Open":17958} ]行情數(shù)據(jù) {"Sell":18022.81,"Volume":4.56,"Buy":18022.79,"Last":18022.8,"High":18022.81,"Time":1498838400800,"Low":18022.79 }深度數(shù)據(jù) {"Bids":[{"Price":18022.79, "Amount":15},{"Price":18022.78, "Amount":15},{"Price":18022.77, "Amount":15},{"Price":18022.76, "Amount":15},{"Price":18022.75, "Amount":15},{"Price":18022.74, "Amount":15},{"Price":18022.73, "Amount":15},{"Price":18022.72, "Amount":15},{"Price":18022.71, "Amount":15},{"Price":18022.7, "Amount":15},{"Price":18022.69, "Amount":15}],"Asks":[{"Price":18022.81, "Amount":15},{"Price":18022.82, "Amount":15},{"Price":18022.83, "Amount":15},{"Price":18022.84, "Amount":15},{"Price":18022.85, "Amount":15},{"Price":18022.86, "Amount":15},{"Price":18022.87, "Amount":15},{"Price":18022.88, "Amount":15},{"Price":18022.89, "Amount":15},{"Price":18022.9, "Amount":15},{"Price":18022.91, "Amount":15}] }?
轉(zhuǎn)載于:https://www.cnblogs.com/fangbei/p/7209743.html
總結(jié)
以上是生活随笔為你收集整理的BotVS开发基础—2.1 账户、行情、K线、深度的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ViewStub 简介
- 下一篇: 什么是软件实施?软件实施前景几何?软件实