diff --git a/manual_strategy/TheoreticallyOptimalStrategy.py b/manual_strategy/TheoreticallyOptimalStrategy.py index 4c4db2f..fa55771 100644 --- a/manual_strategy/TheoreticallyOptimalStrategy.py +++ b/manual_strategy/TheoreticallyOptimalStrategy.py @@ -1,18 +1,17 @@ import pandas as pd -import datetime as dt -from util import get_data, plot_data +from util import get_data +from marketsim.marketsim import compute_portvals +from optimize_something.optimization import calculate_stats def author(): return "felixm" -def main(): - start_date = dt.datetime(2008, 1, 1) - end_date = dt.datetime(2009, 12, 31) - prices = get_data(['JPM'], pd.date_range(start_date, end_date)) - print(prices) +def testPolicy(symbol, sd, ed, sv): + print(f"{symbol=} {sd} - {ed} {sv=}") + # trade = date, shares (-2000, -1000, 0, 1000, 2000) + prices = get_data([symbol], pd.date_range(sd, ed)) + print(prices.index) + return - -if __name__ == "__main__": - main() diff --git a/manual_strategy/indicators.py b/manual_strategy/indicators.py index eedeb4b..b5fe395 100644 --- a/manual_strategy/indicators.py +++ b/manual_strategy/indicators.py @@ -1,5 +1,37 @@ - +import datetime as dt +import TheoreticallyOptimalStrategy as tos def author(): return "felixm" + + +def test_policy(): + sd = dt.datetime(2008, 1, 1) + ed = dt.datetime(2009, 12, 31) + tos.testPolicy(symbol="JPM", sd=sd, ed=ed, sv=100000) + + +def normalize(timeseries): + return timeseries / timeseries.iloc[0] + + +def bollinger_band(prices): + pass + + +def main(): + test_policy() + # sd = dt.datetime(2008, 1, 1) + # ed = dt.datetime(2009, 12, 31) + # prices = get_data(['JPM'], pd.date_range(sd, ed)) + # prices['JPM'] = normalize(prices['JPM']) + # print(prices) + + # plot_data(prices) + # prices_appl = get_data(['AAPL'], pd.date_range(sd, ed), 'High') + # prices['AAPL'] = prices_appl['AAPL'] + + +if __name__ == "__main__": + main()