Git Product home page Git Product logo

yliveticker's People

Contributors

alparamonov avatar ridulfo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yliveticker's Issues

Stopped working

Seems like this library stopped working. I am not sure if this is python version or changes in the data format. Can you please help. Do you see similar issues.
I am using python 3.8.

Need help to use the output of yliveticker and save to database

Subject
I need some help on how to use the output of yliveticker and save to database

Question
First of all @alparamonov you have done a fantastic job by creating this tool ! I have tested it and it works good. But my question are ...

  1. When I use the yliveticker the python code is stuck reading it, means it dont go to the next line. As yliveticker is contunously streaming data, how can i store it to sqlite db ? (means code is just executing on yliveticker it wont going ahead)

  2. I have observed that when I use multiple tickers like 30-50 some ticks may be missing. i.e. on my test single ticker gave me approx 1-4 tick per sec and multiple ticker (like 30-50) might missing some of the ticks on same time window. Did you encountered this issue ? (I am using all F&O Tickers of NSE - Indian Stock Market)

  3. I need your suggestion, I am planning to build an alert system and finally make it to full fledged algo system. Can I use yliveticker in Async or lets say concurrently ? ( I am very new to python !) my plan is as under.

                                       Ticker_1                              Ticker_2                              Ticker_3            And so on upto 160 Tickers
                                          |                                          |                                          |            
                                       Get live Data                    Get Live Data                     Get Live Data      
                                          |                                          |                                          |            
                                       Store to DB                    Store to DB                           Store to DB
                                          |                                          |                                          |            
                                       Build OHLCV (5min)         Build OHLCV (5min)          Build OHLCV (5min)
                                          |                                          |                                          |            
                                       Tech. Analysis                 Tech. Analysis                      Tech. Analysis
                                          |                                          |                                          |            
                                       Get Alert                         Get Alert                               Get Alert
    

I am planning to complete all of the above tasks in approx 1-2 seconds. If 160 Tickers at one take time then I make different files each to running 30 or 40 or 50 tickers.

Can you guide me to help yliveticker with async or whatever is required for working simultaneously ?

As of now I tried using yahooquery and sqlite3 to make simple database system. But now i want to use live streaming of data using your application.

Eagerly waiting for your reply !

Thanks & Regards,
Vishvesh Upadhyay.

Is this still working

v0.3
Is this still working?
No data printed from direct samples provided.
Trading hours.

Updating 'ticker_names' in real time

Hello,

Is there a way to update the ticker_names variable after the WebSocket has started running or does the connection have to close first?

For example, say I pass two tickers into the WebSocket at the open, and then at noon a third ticker meets my criteria to begin streaming the price data. Can I update my list of tickers from the open to include this third symbol without closing the connection I currently have or does it have to be closed?

messages should be printed to stderr

Describe the bug
It is a good practice to send the primary output to stdout while errors and log messages to stderr. See also https://clig.dev/#the-basics

To Reproduce
Start YLiveTicker and you'll see everything going to stdout:

### connection is open ###
{'id':...

Expected behavior
The line ### connection is open ### should go to stderr as well as any other log messages that are not json lines.

Environment (please complete the following information):

  • Python Version: 3.6
  • OS: Linux
  • Version: yliveticker 0.2.7

Connection is already closed. ### connection is closed###

Describe the bug
I have noticed that if you listen to too many symbols using one YLiveTicker object, not all the updates get through. Or more specifically, the number of updates is not proportional to the number of tickers listened to.
To solve this I split the symbols I want to listen to into chucks and create a YLiveTicker object per check on a thread.

However, sometimes I get this output on one of the threads: (Added a dot on the second line to prevent markdown formating)

Connection is already closed.
.### connection is closed###

It seems like yahoo closes sockets.
Since I am listening to symbols where the market currently isn't open, yahoo might close the threads with only those symbols. I am not sure that this is the case though.

To Reproduce
Open a hundred threads/connections. See code below.

Expected behavior
Should not be closed. (lol)

Environment (please complete the following information):

  • Python Version: 3.8
  • OS: Ubuntu 20

Appendix
This is the code I use to open a connection on a thread and also the hotfix:

def getterThread(id, tickerList):
    """
    Created a socket to yahoo listening for price changes to the tickers.
    If the socket closes a new it is reopened. This is done 5 times.
    More than this and yahoo might perm ban(?).
    """
    print(id, "Stating thread")
    for _ in range(5):
        yliveticker.YLiveTicker(on_ticker=lambda msg: queue.append(msg), ticker_names=tickerList)
        print(id, "socket closed, reopening!")
#Omitted some code
    exit(0) #Exiting the whole program

Also

tickers = db.getAllSymbols()
for id, chunk in enumerate(chunks(tickers, 50)):
    t = Thread(target=getterThread, args=(id, chunk))
    t.start()

EDIT:
chunks function in the second codeblock (in the for-loop) takes a list and splits it into lists of 50 elements per list.
chuck(List) -> List[List]

"GC=F" doesn't work sometimes

Hello, I just tested your library for my simple project and I found two problem :

(1)I had to use downgrade package protobuf==3.20.*
I reinstalled the package.

(2)I found "JPY=X" work successfully on this time.
and "GC=F", "AAPL", "SI=F" is not working.
I know if its out of trading hours it is not working.
but when I go to yahoo finance I found "GC=F" is alive.

https://finance.yahoo.com/quote/GC%3DF/history?p=GC%3DF

you can see message "As of 09:34PM EDT. Market open."
and yliveticker cannot get "GC=F" price

I will paste my code here :
`
import yliveticker #Descriptors cannot be created directly error

def on_new_msg(ws,msg):
print(msg)

if name == 'main':
yliveticker.YLiveTicker(on_ticker=on_new_msg, ticker_names=["GC=F"])
`

this code output this message only:

[2022-08-12 10:46:19.526405] ### connection is open ###


for your reference, my time is korea standard time(KST, UTC+09:00)

FUTURES not UPDATING

Describe the bug
Don't know why but Futures do not update

To Reproduce
Ask for Gold Future, for example, GC=F
Expected behavior
Should get updates from GC=F price

Environment (please complete the following information):

  • Python Version: 2.7.16
  • OS: raspbian
  • Version 4.19.97-v7+ #1294

Additional context
Works for tickers like AAPL. Fails for BZ=F, CL=F, ES=F, etc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.