Exemple #1
0
# -*- coding: utf-8 -*-
from app.BinanceAPI import BinanceAPI
from app.authorization import api_key, api_secret
from data.runBetData import RunBetData
from app.dingding import Message
import time

binan = BinanceAPI(api_key, api_secret)
runbet = RunBetData()
msg = Message()


class Run_Main():
    def __init__(self):
        self.coinType = runbet.get_cointype()  # 交易币种
        pass

    def loop_run(self):
        while True:
            cur_market_price = binan.get_ticker_price(
                runbet.get_cointype())  # 当前交易对市价
            grid_buy_price = runbet.get_buy_price()  # 当前网格买入价格
            grid_sell_price = runbet.get_sell_price()  # 当前网格卖出价格
            quantity = runbet.get_quantity()  # 买入量
            step = runbet.get_step()  # 当前步数

            if grid_buy_price >= cur_market_price:  # 是否满足买入价
                res = msg.buy_limit_msg(self.coinType, quantity,
                                        grid_buy_price)
                if res['orderId']:  # 挂单成功
                    runbet.modify_price(grid_buy_price,
Exemple #2
0
# wechat : findpanpan
from data.runBetData import RunBetData
from app.BinanceAPI import BinanceAPI
from app.authorization import api_key,api_secret
from data.calcIndex import CalcIndex

binan = BinanceAPI(api_key,api_secret)
index = CalcIndex()
runbet = RunBetData()

tmp_data = {
    "runBet": {
        "next_buy_price": 0,
        "grid_sell_price": 0,
        "step": 0
    },
    "config": {
        "profit_ratio": 0,
        "double_throw_ratio": 0,
        "cointype": "",
        "quantity": []
    }
}

class CreateData():
    def __init__(self):
        pass



if __name__ == "__main__":