pyminerva 0.0.415__tar.gz → 0.0.417__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyminerva-0.0.415 → pyminerva-0.0.417}/PKG-INFO +1 -1
- {pyminerva-0.0.415 → pyminerva-0.0.417}/pyminerva/strategy.py +4 -16
- {pyminerva-0.0.415 → pyminerva-0.0.417}/pyminerva.egg-info/PKG-INFO +1 -1
- {pyminerva-0.0.415 → pyminerva-0.0.417}/setup.py +1 -1
- {pyminerva-0.0.415 → pyminerva-0.0.417}/LICENSE +0 -0
- {pyminerva-0.0.415 → pyminerva-0.0.417}/README.md +0 -0
- {pyminerva-0.0.415 → pyminerva-0.0.417}/pyminerva/__init__.py +0 -0
- {pyminerva-0.0.415 → pyminerva-0.0.417}/pyminerva/base.py +0 -0
- {pyminerva-0.0.415 → pyminerva-0.0.417}/pyminerva/data/__init__.py +0 -0
- {pyminerva-0.0.415 → pyminerva-0.0.417}/pyminerva/korea.py +0 -0
- {pyminerva-0.0.415 → pyminerva-0.0.417}/pyminerva/tech.py +0 -0
- {pyminerva-0.0.415 → pyminerva-0.0.417}/pyminerva/utils/__init__.py +0 -0
- {pyminerva-0.0.415 → pyminerva-0.0.417}/pyminerva/utils/constant.py +0 -0
- {pyminerva-0.0.415 → pyminerva-0.0.417}/pyminerva/utils/naverApi.py +0 -0
- {pyminerva-0.0.415 → pyminerva-0.0.417}/pyminerva/utils/strategy_funcs.py +0 -0
- {pyminerva-0.0.415 → pyminerva-0.0.417}/pyminerva.egg-info/SOURCES.txt +0 -0
- {pyminerva-0.0.415 → pyminerva-0.0.417}/pyminerva.egg-info/dependency_links.txt +0 -0
- {pyminerva-0.0.415 → pyminerva-0.0.417}/pyminerva.egg-info/top_level.txt +0 -0
- {pyminerva-0.0.415 → pyminerva-0.0.417}/setup.cfg +0 -0
- {pyminerva-0.0.415 → pyminerva-0.0.417}/tests/test_economics_db.py +0 -0
- {pyminerva-0.0.415 → pyminerva-0.0.417}/tests/test_global_.py +0 -0
- {pyminerva-0.0.415 → pyminerva-0.0.417}/tests/test_strategy.py +0 -0
|
@@ -50,15 +50,6 @@ from .utils.strategy_funcs import (
|
|
|
50
50
|
# funtions
|
|
51
51
|
#####################################
|
|
52
52
|
|
|
53
|
-
'''
|
|
54
|
-
Timing Model & GTTA (Global Tactical Asset Allocation) Strategy
|
|
55
|
-
Asset Class Trend Following¶
|
|
56
|
-
http://papers.ssrn.com/sol3/papers.cfm?abstract_id=962461
|
|
57
|
-
BUY RULE: Buy when monthly price > 10-month SMA.
|
|
58
|
-
SELL RULE: Sell and move to cash when monthly price < 10-month SMA.
|
|
59
|
-
GTAA consists of five global asset classes: US stocks, foreign stocks, bonds, real estate and commodities.
|
|
60
|
-
'''
|
|
61
|
-
# 새로운 포트폴리오 구성하는 방안으로 설정하면.
|
|
62
53
|
def get_sma(ticker:str, short_sma=20, long_sma=200):
|
|
63
54
|
data = pd.DataFrame()
|
|
64
55
|
ticker_file = base.data_dir + f'/{ticker}_hist_1day.csv'
|
|
@@ -109,17 +100,14 @@ def timing_strategy(ticker, short_sma, long_sma):
|
|
|
109
100
|
print(f"=== 100: {result}")
|
|
110
101
|
buf = result[result['Pivot'] == 1].reset_index()
|
|
111
102
|
# 날짜를 기준으로 최대 날짜의 인덱스를 찾기
|
|
112
|
-
|
|
103
|
+
buf['date'] = pd.to_datetime(buf['date'])
|
|
104
|
+
most_recent_buf = buf.loc[buf.groupby('ticker')['date'].idxmax()]
|
|
105
|
+
print(f"most_recent_buf: {most_recent_buf}")
|
|
113
106
|
|
|
114
|
-
print(f"latest_indices: {latest_indices}")
|
|
115
|
-
# 최대 날짜의 거래 내역을 발췌
|
|
116
|
-
# latest_date = buf.loc[latest_indices]
|
|
117
|
-
latest_date = datetime.strptime(buf.iloc[latest_indices], "%Y-%m-%d")
|
|
118
|
-
print(f"latest_date: {latest_date}")
|
|
119
107
|
# Change rate 비율만큼 Buy/Sell 실행할것, 초기 설정은 임계값 상승돌파하면 75% 추가매수, 하락돌파하면 75% 매도
|
|
120
108
|
# pivot_tickers = latest_date[latest_date['date'] >= day5_ago] # for test: '2023-05-16'
|
|
121
109
|
day30_ago = find_30days_ago() # 30일 이전까지 피벗날짜 없으면 실행하기 늦었다고 판단했음.
|
|
122
|
-
pivot_tickers = latest_date[
|
|
110
|
+
pivot_tickers = latest_date[most_recent_buf['date'] >= day30_ago] # for test: '2023-05-16'
|
|
123
111
|
print(f"=== 200: {pivot_tickers}")
|
|
124
112
|
base.log_report.info(f' Timing_strategy: {ticker} Only 1day '.center(60, '*'))
|
|
125
113
|
|
|
@@ -11,7 +11,7 @@ with open('requirements.txt') as f:
|
|
|
11
11
|
|
|
12
12
|
setup(
|
|
13
13
|
name='pyminerva',
|
|
14
|
-
version='0.0.
|
|
14
|
+
version='0.0.417', # version.directory.file
|
|
15
15
|
description='To get an insight from Financial Data Anlaysis',
|
|
16
16
|
url='',
|
|
17
17
|
author='Jeongmin Kang',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|