QuantRocket logo
Disclaimer


FX Business Day Strategy › Part 4: Moonshot Backtest


Moonshot Strategy Code¶

Because Moonshot is Pandas-based, our interactive strategy code can readily be transferred to a Moonshot strategy. The file fx_bizday.py contains our transferred strategy code. We've added FX commissions and one-way slippage of 0.1 basis points.

Install strategy file¶

Moonshot looks for strategies inside the "moonshot" directory, so execute the following cell to "install" the strategy by moving the file to that location:

In [1]:
# make directory if doesn't exist
!mkdir -p /codeload/moonshot

!mv fx_bizday.py /codeload/moonshot/

Run backtest¶

Next we can run the backtest:

In [2]:
from quantrocket.moonshot import backtest
backtest(
    "fx-bizday", 
    start_date="2005-03-10",
    end_date="2024-03-10",
    segment="Y", # run backtest in 1-year segments to reduce memory usage
    filepath_or_buffer="fx_bizday_backtest.csv", 
)

And view the performance:

In [3]:
from moonchart import Tearsheet
Tearsheet.from_moonshot_csv("fx_bizday_backtest.csv")

Next Up¶

Part 5: Parameter Scans