日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

BotVS开发基础—2.1 账户、行情、K线、深度

發布時間:2023/12/20 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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线、深度的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。