Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All zeroes in topic/items of block #28

Open
joflo5712 opened this issue Oct 16, 2020 · 4 comments
Open

All zeroes in topic/items of block #28

joflo5712 opened this issue Oct 16, 2020 · 4 comments

Comments

@joflo5712
Copy link

bridge.txt
Hi: I am trying to connect to TOS using the TOSDataBridge.
I have installed the engine and got it running on a Window 10 work station running x64.
I have the TOS platform running,
I installed the tosdb python library on the same machine along with python V 3.9.0
I attempted to exercise the system by running code similar to the example python code provided.
I am able to see the connection all the way to the TOS platform.
But when I attempt to display blocks for items/topics, I get all zeroes.
I am accessing the TOS platform after trading hours. Do I need to do some setup on the TOS platform?

Thanks!
Joseph Flores---------------------------------------------------------

Here is the output:
C:\Users\J\scripts\bridge>python bridge.py

  • Using Module(s) D:/TOS/TOSDataBridge-master/bin\Release\x64\tos-databridge-0.9-x64.dll
    D:/TOS/TOSDataBridge-master/bin\Release\x64/_tos-databridge-x64.dll
  • Last Update: Thu Oct 15 11:05:05 2020
  • Process ID: 12864
  • Succesfully Connected to Service\Engine
  • Succesfully Connected to TOS
    Connected: True
    State: 2 True
    Block Limit: 10
    Block Limit: 20
    Active Blocks: 0
    ASK
    ASK
    ['ASK', 'BID', 'LAST', 'VOLUME']
    Block topics: ['ASK', 'BID', 'LAST', 'VOLUME']
    Block items: ['QQQ', 'SPY']
    Block topics precached: []
    Block items precached: []
    Block info: {'Name': 'b0c38fdee10f4d44b7bae822e400eaf9', 'Items': ['QQQ', 'SPY'], 'Topics': ['ASK', 'BID', 'LAST', 'VOLUME'], 'ItemsPreCached': [], 'TopicsPreCached': [], 'Size': 10000, 'DateTime': 'Enabled', 'Timeout': 2000}
    Block:
    ASK BID LAST VOLUME
    QQQ 0.000000 0.000000 0.000000 0
    SPY 0.000000 0.000000 0.000000 0

Total_frame: dict_keys(['QQQ', 'SPY'])
Total_frame (last): ('0.000000', TOSDB_DateTime(micro=0, sec=0, min=0, hour=0, day=0, month=1, year=1900))
Total_frame (volume): ('0', TOSDB_DateTime(micro=0, sec=0, min=0, hour=0, day=0, month=1, year=1900))

  • Closing Blocks
  • Disconnecting From Service \ Engine
  • Closing Module(s) D:\TOS\TOSDataBridge-master\bin\Release\x64\tos-databridge-0.9-x64.dll
    D:\TOS\TOSDataBridge-master\bin\Release\x64_tos-databridge-x64.dll
@bran112299
Copy link

I have the same issue. I set a time.sleep() and sometimes it works, then randomly it will just display all 0's when I print the block.

@jeog
Copy link
Owner

jeog commented Mar 14, 2021

The bridge just naively takes in whatever TOS sends out. At times, like in the after-hours session, this can happen. Looking at the historical data for a particular stream should give you a better idea of what's happening.

@Jeffdunham1
Copy link

I also tried to use TOSDataBridge V0.9 with Python 3.9 and it gives the readout it connects to everything fine but even during market hours it refuses to grab anything except for the daily timeframe information.

tosdb.init(root= 'C:/root') 
block_QQQ= tosdb.TOSDB_DataBlock(10000, True)
tosdb.set_block_limit(20)
block_QQQ.add_items('QQQ)
block_QQQ.add_topics('Open', 'High', 'Low', 'Last', 'Volume')
b= block_QQQ.stream_snapshot('QQQ', "Open", date_time=False, end=9, beg=0)
print(b)

###Output of b
[362.8, 362.8, 362.8]

Is this just because I am using DataBridge version 0.9 or am I doing something wrong? if anyone has gotten to work on python I would love to see a code example if possible.

@jeog
Copy link
Owner

jeog commented Oct 9, 2021

It looks like you're pulling a snapshot of the day's open which is always going to be the same value as there is only one open price. (Certain fields, like OPEN, don't really lend themselves to a stream.)

If you're looking for OHLC values of intraday bars you need to create it yourself using a stream of LAST values, and their datetime, or use the tosdb.intervalize package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants