backtest utils
Project description
quantrading
- 백테스팅 유틸 라이브러리입니다.
설치
$ pip install quantrading
사용 예시
example -> simple_stock_8_bond_2_strategy.py 참고
import quantrading as qt
from datetime import datetime
import pandas as pd
class MyStrategy(qt.Strategy):
def __init__(self, **kwargs):
super().__init__(**kwargs)
def on_data(self):
today_date = self.date
allocation = {
'MSCI_WORLD_ACWI': 0.8,
'IEF_BOND_7_10_INDEX': 0.2
}
print(today_date, allocation)
allocation_series = pd.Series(allocation)
self.reserve_order(allocation_series)
if __name__ == "__main__":
market_df = pd.read_csv("./stock_bond_data.csv", index_col=0, parse_dates=True)
market_df = market_df.ffill()
simulation_args = {
"market_df": market_df,
"name": "주식8 채권2 전략",
"start_date": datetime(2005, 1, 1),
"end_date": datetime(2020, 7, 31),
"rebalancing_periodic": "monthly",
"rebalancing_moment": "first",
}
strategy = MyStrategy(**simulation_args)
strategy.run()
strategy.result_to_excel(folder_path="simulation_result")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for quantrading-0.1.24-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a4c41265b49fdc845016867b599cb77b21eddbe46d8cd1ce68f3829e385e1a0 |
|
MD5 | 1e977de72925c3aa32e92fa9af647e02 |
|
BLAKE2b-256 | 746ded50017f70987d9ae412ed105f1b32636549ce0fc4120819b0d7d929cace |