ferdn4ndo / candlestick-data-lake

A data lake application for candlestick crawling, storage and syncronous (API) and asyncronous (WebSockets) serving
MIT License
0 stars 0 forks source link

Implement initial data load #9

Closed ferdn4ndo closed 3 years ago

ferdn4ndo commented 3 years ago

The objective is develop a flow to retrieve initial data from exchange and save on database. Creates:

This consumer have two main functions:

An example on how to consume crated classes:

import os

from app.clients.binance.binance_client import BinanceClient
from app.services.consumer_service import ConsumerService
from app.services.exchanges.binance_exchange_service import BinanceExchangeService
from sqlalchemy import create_engine
from sqlalchemy.orm import Session, sessionmaker

engine = create_engine(os.getenv("DATABASE_URL"))
Session = sessionmaker(bind=engine)
session = Session()

client = BinanceClient()
service = BinanceExchangeService(session)

consumer = ConsumerService(client, service)
consumer.populate_exchange_data()
consumer.populate_candlesticks("BTCUSDT")