Exemplo n.º 1
0
from datetime import datetime, timedelta
from pathlib import Path

from lib.dataset import Dataset

from client.db_client import DBClient
from client.exchange_client import ExchangeClient

bitmex_exchange_client = ExchangeClient("bitmex", "config.ini")
mysql_client = DBClient("mysql", "config.ini")

dataset_manager = Dataset(mysql_client, bitmex_exchange_client, True)

start_time = datetime.now() - timedelta(days=200)
end_time = datetime.now()

dataset_manager.update_ohlcv("bitmex", start_time)
Exemplo n.º 2
0
from client.exchange_client import ExchangeClient
from client.db_client import DBClient
from client.exchange_ws_client import WSClient
from lib.pandamex import PandaMex
from lib.time_ms import TimeMS
from lib.dataset import Dataset

from hypothesis_test.fetch_high_frequency_data_test import FetchHighFrequencyData
from hypothesis_test.h_price_move_probability import HPriceMovePlobability
from hypothesis_test.volatility_dependent_offset_test import VolatilityDependentOffsetTest

from bot.bottom_trend_follower import BottomTrendFollow

bitmex_exchange_client = ExchangeClient("bitmex",
                                        Path("tradingbot/config.ini"))

# influx_client = DBClient("influxdb")
# print(influx_client.connector.get_list_database())

mysql_client = DBClient("mysql", Path("tradingbot/config.ini"))

# update database
dataset_manager = Dataset(mysql_client, bitmex_exchange_client)
download_start_time = datetime.now() - timedelta(days=1000)
dataset_manager.update_ohlcv("bitmex", download_start_time)

bot_bot = BottomTrendFollow(db_client=mysql_client,
                            exchange_client=bitmex_exchange_client,
                            is_backtest=True)
bot_bot.run()
from technical_analysis.so import TechnicalAnalysisSTOCH
from technical_analysis.williamsr import TechnicalAnalysisWilliamsR
from technical_analysis.wma import TechnicalAnalysisWMA

# option settings
pd.set_option("display.max_columns", 250)
pd.set_option("display.max_rows", 250)
import warnings
warnings.filterwarnings('ignore')
plt.rcParams['figure.figsize'] = (10.0, 20.0)

bitmex_exchange_client = ExchangeClient("bitmex", Path(config_ini))
mysql_client = DBClient("mysql", Path(config_ini))
dataset_manager = Dataset(mysql_client, bitmex_exchange_client, True)
dataset_manager.update_ohlcv("bitmex",
                             start_time=datetime.now() - timedelta(days=365),
                             with_ta=True)


# manually added
def get_joined_params_and_summary():
    bot = BottomTrendFollow(db_client=mysql_client,
                            exchange_client=bitmex_exchange_client,
                            is_backtest=True)
    backtest_management = bot.trading_bot_backtest.trading_bot_backtest_db.backtest_management_table(
    )
    backtest_summary = BacktestSummary()

    query_management = "SELECT * FROM " + bot.trading_bot_backtest.trading_bot_backtest_db.backtest_management_table_name + ";"
    query_summary = "SELECT * FROM backtest_summary;"
Exemplo n.º 4
0
from technical_analysis.rsi import TechnicalAnalysisRSI
from technical_analysis.so import TechnicalAnalysisSTOCH
from technical_analysis.williamsr import TechnicalAnalysisWilliamsR
from technical_analysis.wma import TechnicalAnalysisWMA

# option settings
pd.set_option("display.max_columns", 250)
pd.set_option("display.max_rows", 250)
import warnings
warnings.filterwarnings('ignore')
plt.rcParams['figure.figsize'] = (10.0, 20.0)

bitmex_exchange_client = ExchangeClient("bitmex", Path(config_ini))
mysql_client = DBClient("mysql", Path(config_ini))
dataset_manager = Dataset(mysql_client, bitmex_exchange_client)
dataset_manager.update_ohlcv("bitmex")


# manually added
def get_joined_params_and_summary():
    bot = BottomTrendFollow(db_client=mysql_client,
                            exchange_client=bitmex_exchange_client,
                            is_backtest=True)
    backtest_management = bot.backtest_management_table()
    backtest_summary = BacktestSummary()

    query_management = "SELECT * FROM " + bot.backtest_management_table_name + ";"
    query_summary = "SELECT * FROM backtest_summary;"

    backtest_management_df = mysql_client.exec_sql(query_management)
    backtest_summary_df = mysql_client.exec_sql(query_summary)