Skip to content

Make DRY #294

@MDUYN

Description

@MDUYN

Many declarations in the framework can be simplified to avoid repetition or long declarations.

The goal is to have a app creation that looks as follows:

from investing_algorithm_framework import MarketConfiguration, create_app

app = create_app()
app.add_market(market=bitvavo”, api_key="", secret_key="", initial_balance=1000)

class TwitterDataProver(DataProvider):
pass

class TwitterBot(TradingStrategy):
    data_sources = [
	DataProviderSpecifier(data_type=ohlcv”, symbol=btc/eur”, window_size=200, time_frame="2h”),
        DataProviderSpecifier(data_type=custom”, id="test”),
        TwitterDataProver
    ]

    def run_strategy(context, market_data):
	pass
    
    app.add_strategy(TwitterBot) 

Portfolio configuration

It would be nice, make the market configuration, portfolio configuration and market credentials simpler. We could combine the three objects so we can initialize it in a single line. For simple portfolio configurations we could do something like:

from investing_algorithm_framework import MarketConfiguration, create_app

app = create_app()
app.add_market(market=bitvavo”, api_key="", secret_key="", initial_balance=1000)

or

# Given that it will read the api_key and secret_key in the .env file
app = create_app()
app.add_market(market=bitvavo”)

or

# Given that it will read the api_key and secret_key in the .env file
app = create_app(market="bitvavo", trading_symbol="USD", initial_balanace=1000)

Data providers

Custom data provider

class MyDataProvider(DataProvider):
id = "hhoohgeao"
.....
app = create_app()
app.add_data(data_type=custom”, id=test”, data_provider=MyDataProvider)

Or with ccxt

app = create_app()
app.add_data(data_type="ohlcv", symbol="btc/eur", market="bitvavo")

Or when directly using the data

from investing_algorithm_framework import download
btc_eur = download('BTC-EUR', data_type="ohlcv", start_date='2020-01-01', end_date='2024-01-01', pandas=True, save=True, storage_dir=<>)

Strategies

It should be able to at

class TwitterBot(TradingStrategy):
    data_sources = [
	DataSpecifier(data_type=ohlcv”, symbol=btc/eur”, window_size=200, time_frame="2h”),
        DataSpecifier(data_type=custom”, id="test”)
    ]

    def run_strategy(context, market_data):
	pass
    
    app.add_strategy(TwitterBot) 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions