A flexible and agile stock market data scraper and server.
Project description
YFrake
Description
YFrake is a flexible and agile stock market data scraper and server [note1]. It enables developers to build powerful apps without having to worry about maximizing network request throughput [note2]. YFrake can be used as a client to directly return market data or as a programmatically controllable server to forward data to web clients. In addition, all network requests by YFrake are non-blocking, which means that your program can continue running your code while network requests are in progress. The best part about YFrake is its built-in swagger API documentation which you can use to perform test queries and examine the returned responses.
Getting Started
Installation
pip install yfrake
How to import
from yfrake import tclient # An instance of ThreadClient class.
from yfrake import aclient # An instance of AsyncClient class.
from yfrake import server # An instance of Server class.
ThreadClient example
tclient.request('historical_prices', symbol='msft', interval='1d', range='1y')
while tclient.is_busy():
# Do other stuff
if tclient.is_done() and not tclient.response.error:
print(tclient.response.data)
AsyncClient example
async def main():
resp = await aclient.get_historical_prices(symbol='msft', interval='1d', range='1y')
if not resp.error:
print(resp.data)
asyncio.run(main())
Server example
server.start() # Default address is 'localhost:8888'
# Do some other stuff
server.stop() # Kills all server sub-processes.
[note1]: Stock market data is sourced from Yahoo Finance.
[note2]: You still need to know how to gather coroutines when using asyncio to maximize throughput.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.