예제 #1
0
 def __init__(self,
              product_code=settings.product_code,
              duration=settings.trade_duration):
     self.product_code = product_code
     self.duration = duration
     self.candle_cls = factory_candle_class(self.product_code,
                                            self.duration)
     self.candles = []
예제 #2
0
 def __init__(self,
              product_code=settings.product_code,
              duration=settings.trade_duration):
     self.product_code = product_code
     self.duration = duration
     self.candle_cls = factory_candle_class(self.product_code,
                                            self.duration)
     self.candles = []
     self.smas = []
     self.emas = []
     self.bbands = BBands(0, 0, [], [], [])
     self.ichimoku_cloud = IchimokuCloud([], [], [], [], [])
예제 #3
0
파일: ai.py 프로젝트: yydevelop/study
    def __init__(self, product_code, use_percent, duration, past_period, stop_limit_percent, back_test):
        self.API = APIClient(settings.access_token, settings.account_id)

        if back_test:
            self.signal_events = SignalEvents()
        else:
            self.signal_events = SignalEvents.get_signal_events_by_count(1)

        self.product_code = product_code
        self.use_percent = use_percent
        self.duration = duration
        self.past_period = past_period
        self.optimized_trade_params = None
        self.stop_limit = 0
        self.stop_limit_percent = stop_limit_percent
        self.back_test = back_test
        self.start_trade = datetime.datetime.utcnow()
        self.candle_cls = factory_candle_class(self.product_code, self.duration)
        self.update_optimize_params(False)
예제 #4
0
 def __init__(self,
              product_code=settings.product_code,
              duration=settings.trade_duration):
     self.product_code = product_code
     self.duration = duration
     self.candle_cls = factory_candle_class(self.product_code,
                                            self.duration)
     self.candles = []
     self.fraction_candle = None
     self.smas = []
     self.emas = []
     self.bbands = BBands(0, 0, [], [], [])
     self.atr = Atr(0, 0, [], [])
     self.di = Di(0, [], [])
     self.adx = Adx(0, [], [])
     self.ichimoku_cloud = IchimokuCloud([], [], [], [], [])
     self.rsi = Rsi(0, [])
     self.macd = Macd(0, 0, 0, [], [], [])
     self.force_idx = []
     self.events = SignalEvents()
예제 #5
0
import datetime
import logging
import sys

import app.models
from app.models.candle import factory_candle_class

import settings

logging.basicConfig(level=logging.INFO, stream=sys.stdout)

if __name__ == "__main__":

    cls = factory_candle_class(settings.product_code, '5s')
    for i in range(200):
        now1 = datetime.datetime(2000 + i, 1, 2, 3, 4, 5)
        cls.create(now1, 1.0, 2.0, 3.0, 4.0, 5)

    candles = cls.get_all_candles(3)
    for candle in candles:
        print(candle.value)