BotVS开发基础—2.1 账户、行情、K线、深度
生活随笔
收集整理的這篇文章主要介紹了
BotVS开发基础—2.1 账户、行情、K线、深度
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
代碼
import json def main():Log("賬號信息:", exchange.GetAccount()); # Log("K 線數據:", exchange.GetRecords()); # 獲取K線數據,已成交的記錄Log("行情數據:", exchange.GetTicker()); # 返回行情數據,未成交的掛單Log("深度數據:", exchange.GetDepth()); # 返回市場深度數據 depth = exchanges[0].GetDepth(); # 獲取市場深度Log("depth:", depth); # 日志輸出顯示Log(exchanges[0].GetAccount()); # 輸出 吃單前的 賬戶信息buyPrice = depth.Asks[0].Price; # 設置吃賣單的價格,即賣一,# 有時為確保吃單成功,這樣處理:var buyPrice = depth.Asks[0].Price + slidePrice;buyAmount = depth.Asks[0].Amount; # 吃賣單的量exchanges[0].Buy(buyPrice, buyAmount); # 執行買入操作, 吃掉賣一 這個單子Log(exchanges[0].GetAccount()); # 顯示買入后的 賬戶信息,對比初始賬戶信息。可以對比出 買入操作的成交的數量。返回
賬號信息: {'Balance': 1000000.0, 'Stocks': 3.0, 'FrozenBalance': 0.0, 'FrozenStocks': 0.0}K 線數據 [{"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} ]行情數據 {"Sell":18022.81,"Volume":4.56,"Buy":18022.79,"Last":18022.8,"High":18022.81,"Time":1498838400800,"Low":18022.79 }深度數據 {"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}] }?
轉載于:https://www.cnblogs.com/fangbei/p/7209743.html
總結
以上是生活随笔為你收集整理的BotVS开发基础—2.1 账户、行情、K线、深度的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ViewStub 简介
- 下一篇: 什么是软件实施?软件实施前景几何?软件实