简体   繁体   English

IB_insync 返回微小的 integer 用于共享(1 = 100, 0 = 50?)需要浮点数或适当缩放的整数

[英]IB_insync returning tiny integer for shares (1 = 100, 0 = 50?) need float or proper scaled int

Using IB_insync API.使用 IB_insync API。

When loading ticker.Domticks and receiving the list of ticks, the dollar amount appears to be correct, but the shares show as small integers of 0,1,3,6 etc... When they should most likely be scaled 100x... and zero is most likely for less than 100 shares.加载ticker.Domticks 并接收报价列表时,美元金额似乎是正确的,但份额显示为0、1、3、6 等小整数......当它们最有可能缩放100 倍时......零很可能是少于 100 股。 Because its not a float it can not be scaled.因为它不是浮点数,所以无法缩放。 Does anyone know why it would be returning the shares number incorrectly?有谁知道为什么它会错误地返回股票号码? I did recently subscribe to ASX australian exchange, and noticed that the shares number came back in the thousands, so it is presumably correct.我最近确实订阅了 ASX 澳大利亚交易所,并注意到股票数量以数千计,所以它可能是正确的。 contract = Stock('AAPL', "ISLAND","USD") > contract = Stock('CBA', "ASX","AUD")合约 = 股票('AAPL', "ISLAND","USD") > 合约 = 股票('CBA', "ASX","AUD")

def runner(ticker):
    global elements
    # print(ticker.domTicks)

    for i in range(100):
        if i < len(ticker.domTicks):
            grab = ticker.domTicks[i]
            elements.append(grab)



if __name__ == "__main__":
    depth = 120
    time_samples = 260


    ib = IB()

    ib.connect('127.0.0.1', 7497, clientId=2)
    list_of_exchanges = ib.reqMktDepthExchanges()
    for items in list_of_exchanges:
        print(items)
    print(list_of_exchanges)
    contract = Stock('AAPL', "ISLAND","USD")

    last_bid_book = np.zeros((0,depth))
    print(last_bid_book)

    last_ask_book = np.zeros((0,depth))
    elements = []

    ticker = ib.reqMktDepth(contract)



    ib.sleep(1)





    ticker.updateEvent += runner

Only round lots (and not odd lots) are typically returned with the top-of-book market data feed because the NBBO (National Best Bid/Best Offer) rules only pertain to round-lot orders.由于 NBBO(全国最佳买价/最佳报价)规则仅适用于整手订单,因此通常只返回整手(而不是奇数手)与账面顶部市场数据馈送。

What is an "Odd Lot" in stocks?什么是股票中的“奇数手”?

  • Odd-Lot orders are not posted to the bid/ask data on exchanges奇数手订单不会发布到交易所的买/卖数据

As such the bid/ask data is returned with a multiplier that can be found in the mdSizeMultiplier field of the IBApi.ContractDetails class.因此,买入/卖出数据返回一个乘数,该乘数可在IBApi.ContractDetails class 的mdSizeMultiplier字段中找到。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM