A flexible and agile stock market data scraper and server.
Project description
YFrake
Disclaimer
The current version of YFrake is usable, but not production ready.
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 ThreadClient
from yfrake import AsyncClient
from yfrake import Server
ThreadClient example
client = ThreadClient()
client.get('historical_prices', symbol='msft', interval='1d', range='1y')
while client.is_busy():
# Do other stuff
if client.is_done() and not client.response.error:
print(client.response.data)
AsyncClient example
async def main():
resp = await AsyncClient.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.