-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lots of changes. Modified the Position object to handle more of the a…
…ctual position calculations instead of the Portfolio. Added more unit tests for both Position and Portfolio. Allowed Positions to trade in currencies other than GBPUSD and in base/quotes which aren't the home currency. Modified the backtester to be single-threaded and added a basic Moving Average Crossover strategy. Also added a basic equity curve output script.
- Loading branch information
1 parent
e747778
commit e84512e
Showing
11 changed files
with
695 additions
and
371 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import os, os.path | ||
|
||
import pandas as pd | ||
import matplotlib.pyplot as plt | ||
|
||
from qsforex.settings import OUTPUT_RESULTS_DIR | ||
|
||
|
||
if __name__ == "__main__": | ||
""" | ||
A simple script to plot the balance of the portfolio, or | ||
"equity curve", as a function of time. | ||
It requires OUTPUT_RESULTS_DIR to be set in the project | ||
settings. | ||
""" | ||
equity_file = os.path.join(OUTPUT_RESULTS_DIR, "equity.csv") | ||
equity = pd.io.parsers.read_csv( | ||
equity_file, header=True, | ||
names=["time", "balance"], | ||
parse_dates=True, index_col=0 | ||
) | ||
equity["balance"].plot() | ||
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.