zoukankan      html  css  js  c++  java
  • 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
            }
        ]
    }
     
  • 相关阅读:
    Layui表格之动态添加数据(表格多选解决方案)
    Ztree勾选节点后取消勾选其父子节点
    如何判断某个元素在页面上是否存在
    Linux环境搭建SVN服务
    Linux环境下验证码不显示F12报500
    Ztree节点前加上两个自定义按钮
    解决window.location.href参数太长
    Ztree加载完成默认选中根节点右侧生成表格
    输入框点击下滑Ztree菜单
    Mybatis中and和or的细节处理
  • 原文地址:https://www.cnblogs.com/bitquant/p/7209743.html
Copyright © 2011-2022 走看看