Esempio n. 1
0
import traceback
from collections import deque
import websocket
import codecs

# 默认币种handle_deque
coin = Coin("etc", "usdt")
time_type = "quarter"
file_transaction, file_deal = coin.gen_future_file_name()

deque_min = deque()
deque_10s = deque()
deque_3s = deque()
deque_5m = deque()
latest_price = 0
ind_1min = Indicator(60)
ind_10s = Indicator(10)
ind_3s = Indicator(3)
ind_5m = Indicator(300)
more = 0
less = 0
last_avg_price = 0
buy_price = 0

last_5min_macd = 0
last_5min_macd_ts = 0

write_lines = []


def handle_deque(deq, entity, ts, ind):
# 默认币种handle_deque
coin_name = "etc"
instrument_id = "etc_usdt"
buy_price = 10000
sell_price = 0
amount = 1
sell_queue = []
buy_queue = []
ask_price = 0
bid_price = 0
last_time_sec = 0
last_time_account_sec = 0
latest_deal_price=0
deque_3s = deque()
ind_3s = Indicator(3)


class SpotMaker:
    def __init__(self, interval, spotAPI):
        self.spotAPI = spotAPI
        self.timeInterval = interval
        self.log_file = os.getcwd() + '/spot_maker.log'


    def timeLog(self, log):
        print(log)
        with codecs.open(self.log_file, 'a+', 'utf-8') as f:
            f.writelines(log + '\r\n')

    def get_account_money(self, coin_name):
import asyncio
import websockets
import json
import requests
import dateutil.parser as dp
import hmac
import base64
import zlib
import datetime

deque_min = deque()
deque_10s = deque()
deque_3s = deque()
deque_3m = deque()
latest_price = 0
ind_1min = Indicator(60)
ind_10s = Indicator(10)
ind_1s = Indicator(1)
ind_3m = Indicator(180)
less = 0
lessless = 0
lessmore = 0
last_3min_macd_ts = 0

last_avg_price = 0

future_buy_time = 0
future_buy_price = 0
future_more_buy_price = 0

spot_buy_time = 0
Esempio n. 4
0
import time
import json
import traceback
from collections import deque
import websocket
import codecs
import sys

SWAP_SIZE = 1
deque_3s = deque()
deque_10s = deque()
deque_min = deque()
deque_3m = deque()
deque_15m = deque()
latest_price = 0
ind_3s = Indicator(3)
ind_10s = Indicator(10)
ind_1min = Indicator(60)
ind_3m = Indicator(180)
ind_15m = Indicator(900)
less = 0
more = 0

lever_sell_time = 0
lever_sell_price = 0
lever_more_time = 0
lever_more_price = 0

swap_more_price = 0
swap_less_price = 0
swap_more_time = 0