-
Notifications
You must be signed in to change notification settings - Fork 0
/
PCF1.py
47 lines (30 loc) · 990 Bytes
/
PCF1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# -*- coding: utf-8 -*-
"""
Created on Wed May 11 13:48:38 2022
@author: mtang
"""
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 7 13:46:22 2022
@author: mtang
"""
import json
import datetime
import pandas as pd
import numpy as np
import quantlib.data_utils as data_utils
import quantlib.general_utils as general_utils
class PCY():
def __init__(self, ticker, alpha, ma_short, ma_long, ohlc_file_path, output_file_path):
self.ohlc_file_path = ohlc_file_path
self.output_file_path = output_file_path
self.ticker = ticker
self.alpha = alpha
self.data = pd.DataFrame()
self.ma_short = ma_short # small moving average
self.ma_long = ma_long # large moving average
def pcy(self):
#1. read the ohlc data
self.ohlc = pd.read_csv(self.ohlc_file_path +"\\"+ self.ticker + ".csv", index_col=0, header=0,parse_dates=[0])
self.ohlc['MAK']
return