Skip to content

Make DRY #294

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
MDUYN opened this issue Feb 19, 2025 · 0 comments
Open

Make DRY #294

MDUYN opened this issue Feb 19, 2025 · 0 comments

Comments

@MDUYN
Copy link
Collaborator

MDUYN commented Feb 19, 2025

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) 
@MDUYN MDUYN changed the title Add portfolio configuration and market credential shortcut notation Make DRY Mar 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant