Lumiwealth / lumibot

Backtesting and Trading Bots Made Easy for Crypto, Stocks, Options, Futures, FOREX and more
GNU General Public License v3.0
854 stars 156 forks source link

Constructor for custom datetime doesn't work #497

Open 201508876PMH opened 1 month ago

201508876PMH commented 1 month ago

Constructor for timezone can't be overriden. It always stays america

grzesir commented 1 month ago

What do you mean exactly? Can you provide code and screenshots of the error?

Robert Grzesik 347-635-3416

On Wed, Jul 24, 2024 at 3:23 AM Peter Marcus @.***> wrote:

Constructor for timezone can't be overriden. It always stays america

— Reply to this email directly, view it on GitHub https://github.com/Lumiwealth/lumibot/issues/497, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIYQK7IRXQEHGDPYCPTTZ3ZN5I7PAVCNFSM6AAAAABLL3YKBGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQZDMNZZGYZDCNQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

201508876PMH commented 1 month ago

The docs says the data class takes localize_timezone, but is in fact timezone. When then trying to define timezone to anything as UTC, the data object is always still America :)

def load_forex_data():
    base_asset = Asset(symbol="EUR", asset_type='forex')
    quote_asset = Asset(symbol="USD", asset_type='forex')

    df = pd.read_csv('ap-lumibot\data\EURUSD_Candlestick_5_M.csv')
    data = Data(
        asset=base_asset,
        quote=quote_asset,
        df=df,
        timestep="minute",
        timezone='UTC'
    )

    pandas_data = {
        'asset' : data
    }

    return pandas_data, pandas_data['asset'].datetime_start, pandas_data['asset'].datetime_end