Before we schedule fx-bizday
for live or paper trading, we'll run it manually to view the orders it would generate.
Before we can trade, we must allocate fx-bizday
to one or more accounts, and specify how much of the account's capital to allocate. Open quantrocket.moonshot.allocations.yml, edit the account number to match your live or paper brokerage account, and edit the capital allocation percentage as desired.
If you don't already have a quantrocket.moonshot.allocations.yml
in the /codeload
directory (i.e. top level of the Jupyter file browser), you can execute the following command to copy it over. Otherwise, append the new allocation to your existing file.
# move file over unless it already exists
![ -e /codeload/quantrocket.moonshot.allocations.y*ml ] && echo 'oops, the file already exists!' || mv quantrocket.moonshot.allocations.yml /codeload/
Now we can try to run Moonshot and generate orders. Depending on how recently you collected data and whether the market is currently open, you might get an error like the following:
!quantrocket moonshot trade 'fx-bizday'
Moonshot is trying to protect us from trading with stale data. For testing purposes we can work around this error by using the --review-date
parameter to tell Moonshot to generate orders as if it were an earlier date and time. Set the review date to an earlier date and time that is within the date range of your data. Moonshot returns a CSV of orders, which we format for the terminal with csvlook
:
!quantrocket moonshot trade 'fx-bizday' --review-date '2019-02-13 03:01:00' | csvlook
In the above example we simulate running the strategy just after 3 AM, which results in an order to sell EUR.USD.