Python package containing several classes and data for extracting and manipulating market and trading data.
Project description
BTG Solutions - Data Service
It's a Python library to get Brazilian Financial Market Data.
Installation
pip3 install btgsolutions-dataservices-python-client
Example - WebSocket Books
import btgsolutions_dataservices as btg
ws = btg.WebSocketClient(api_key='YOUR_API_KEY', ws_type='books', instruments=['PETR4', 'VALE3'])
ws.run(on_message=lambda message: print(message))
Example - WebSocket Trades Delayed
import btgsolutions_dataservices as btg
ws = btg.WebSocketClient(api_key='YOUR_API_KEY', ws_type='trades', target='delayed', instruments=['PETR4', 'VALE3'])
ws.run(on_message=lambda message: print(message))
Example - WebSocket Candles 1S
import btgsolutions_dataservices as btg
ws = btg.WebSocketClient(api_key='YOUR_API_KEY', ws_type='candles-1S', target='delayed')
ws.run(on_message=lambda message: print(message))
ws.candle_subscribe(list_instruments=['PETR4','VALE3'], candle_type='partial')
ws.candle_subscribe(list_instruments=['PRIO3'], candle_type='closed')
ws.candle_subscribe(list_instruments=['WEGE3'], candle_type='all')
ws.candle_unsubscribe(list_instruments=['PRIO3', 'PETR4'], candle_type='all')
Example - WebSocket High Frequency News
import btgsolutions_dataservices as btg
ws = btg.WebSocketClient(api_key='YOUR_API_KEY', feed='hfn', ws_type='brazil')
ws.run(on_message=lambda message: print(message))
Example - IntradayCandles
import btgsolutions_dataservices as btg
int_candles = btg.IntradayCandles(api_key='YOUR_API_KEY')
int_candles.get_intraday_candles(market_type='stocks', tickers=['PETR4', 'VALE3'], candle_period='1m', mode='relative', raw_data=True)
Example - Plot HistoricalCandles
import btgsolutions_dataservices as btg
hist_candles = btg.HistoricalCandles(api_key='YOUR_API_KEY')
hist_candles.get_historical_candles(ticker='PETR4', lookback='5D', mode='absolute').plot(x='date', y='close_price', kind='scatter')
Example - Quotes
import btgsolutions_dataservices as btg
quotes = btg.Quotes(api_key='YOUR_API_KEY')
quotes.get_quote(market_type = 'stocks', tickers = ['PETR4', 'VALE3'])
Example - BulkData
import btgsolutions_dataservices as btg
bulk_data = btg.BulkData(api_key='YOUR_API_KEY')
bulk_data.get_data(ticker='PETR4', date='2023-07-03', data_type='trades')
Example - Intraday Tick Data
import btgsolutions_dataservices as btg
intra_tickdata = btg.IntradayTickData(api_key='YOUR_API_KEY')
intra_tickdata.get_trades(ticker='PETR4')
Example - HighFrequencyNews
import btgsolutions_dataservices as btg
hfn = btg.HighFrequencyNews(api_key='YOUR_API_KEY')
hfn.latest_news()
Documentation
The official documentation is hosted at https://python-client-docs.dataservices.btgpactualsolutions.com/
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.
Source Distribution
Close
Hashes for btgsolutions-dataservices-python-client-0.11.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8875708f51b56dc92e3dbc4cf510a1c84ba39ca7a9a1062e9a5e29499fed94d |
|
MD5 | 82da3e76ccb347ca0c9deb9e2570f2f8 |
|
BLAKE2b-256 | ffa36ad4bca56f536cf36794d96441adcee887b9c63c0bd9b95060b0eba61314 |