finished converter

This commit is contained in:
2022-05-17 15:58:20 +03:00
parent 1b00f9500a
commit e080b70c80
6 changed files with 187 additions and 6 deletions

View File

@@ -3,7 +3,7 @@
# Let's try to get filepath of any candlesticks file.
# In[2]:
# In[1]:
import market_trade.constants
@@ -15,7 +15,7 @@ candlesticks_filepath
# Let's import that file to pandas
# In[18]:
# In[2]:
import pandas as pd
@@ -24,13 +24,22 @@ import pandas as pd
candlesticks_df = pd.read_csv(candlesticks_filepath,index_col=0, header=[0,1], parse_dates=True)
candlesticks_df['date'] = candlesticks_df.index
candlesticks_df.reset_index(inplace=True, drop=True)
ask_candlesticks_df = candlesticks_df['ask']
ask_candlesticks_df = candlesticks_df['ask'].copy()
ask_candlesticks_df.head()
# Everything imported beatifully.
# Everything imported beatifully, let's attach the date to it
# In[17]:
# In[3]:
ask_candlesticks_df['date'] = candlesticks_df['date']
ask_candlesticks_df.head()
# Let's test it
# In[4]:
"""
@@ -43,11 +52,115 @@ ind_params = {'MeanType': 'SMA', 'window': 5, 'valueType': 'low', 'kDev': 2}
# df_candle[:3000],ind_params,True,False,True
# window 5..100 (5) | valueType: 'open', 'low' | 'kdev' : 1..4 (0.1)
indEl1 = {
'df': ask_candlesticks_df[:3000],
'df': ask_candlesticks_df,
'params': ind_params,
'needFig': False,
'showOnlyIndex': False,
'drawFig': True
}
a = market_trade.signals.Signal1.SignalBollingerBands1({'BB': indEl1})
a.analiz
# Let's test that i didn't broke the file. Let's import test file, and compare results.
#
# Importing
# In[5]:
test_candlesticks = pd.read_csv(market_trade.constants.TEST_CANDLESTICKS_PATH)
test_candlesticks['date'] = test_candlesticks['timestamp']
test_candlesticks.drop(['timestamp'], axis=1, inplace=True)
test_candlesticks.head()
# Comparing results
# In[6]:
"""
expected results
{'chstota': 0.3555926544240401,
'zeroNum %': 0.5963272120200334,
't %': 0.37963272120200336,
'f %': 0.024040066777963272,
'toch': 0.9404466501240695}
"""
import market_trade.signals.Signal1
ind_params = {'MeanType': 'SMA', 'window': 5, 'valueType': 'low', 'kDev': 2}
# df_candle[:3000],ind_params,True,False,True
# window 5..100 (5) | valueType: 'open', 'low' | 'kdev' : 1..4 (0.1)
indEl1 = {
'df': test_candlesticks[:3000],
'params': ind_params,
'needFig': False,
'showOnlyIndex': False,
'drawFig': True
}
a = market_trade.signals.Signal1.SignalBollingerBands1({'BB': indEl1})
a.analiz
# Nice! And lets try full file
# In[16]:
ind_params = {'MeanType': 'SMA', 'window': 5, 'valueType': 'low', 'kDev': 2}
# df_candle[:3000],ind_params,True,False,True
# window 5..100 (5) | valueType: 'open', 'low' | 'kdev' : 1..4 (0.1)
indEl1 = {
'df': test_candlesticks[:10000],
'params': ind_params,
'needFig': False,
'showOnlyIndex': False,
'drawFig': True
}
a = market_trade.signals.Signal1.SignalBollingerBands1({'BB': indEl1})
a.analiz
# Let's test our file loading
# In[8]:
candlesticks_filepaths
# Let's choose EURUSD candletsicks
# In[11]:
candlesticks_filepath = candlesticks_filepaths[5]
candlesticks_df = pd.read_csv(candlesticks_filepath,index_col=0, header=[0,1], parse_dates=True)
candlesticks_df['date'] = candlesticks_df.index
candlesticks_df.reset_index(inplace=True, drop=True)
ask_candlesticks_df = candlesticks_df['ask'].copy()
ask_candlesticks_df['date'] = candlesticks_df['date']
ask_candlesticks_df.head()
# Let's test
# In[15]:
ind_params = {'MeanType': 'SMA', 'window': 5, 'valueType': 'low', 'kDev': 2}
indEl1 = {
'df': ask_candlesticks_df[:10000],
'params': ind_params,
'needFig': False,
'showOnlyIndex': False,
'drawFig': True
}
a = market_trade.signals.Signal1.SignalBollingerBands1({'BB': indEl1})
a.analiz