예제 #1
0
파일: infoGet.py 프로젝트: alvinleee/trade
#!/usr/bin/python
# -*- coding: utf-8 -*-
from gateAPI import GateIO

## 填写 apiKey APISECRET
apiKey = 'your api key'
secretKey = 'your api secret'
## address
btcAddress = 'your btc address'

## Provide constants

API_QUERY_URL = 'data.gateio.io'
API_TRADE_URL = 'api.gateio.io'

## Create a gate class instance

gate_query = GateIO(API_QUERY_URL, apiKey, secretKey)
gate_trade = GateIO(API_TRADE_URL, apiKey, secretKey)


# Trading Pairs
# print(gate_query.getKlineInfo('eth_b'))
print(gate_query.getKlineInfo('eth_usdt', 60, 1))
예제 #2
0
                  "DOGE": "0",
                  "BTM": "0",
                  "XRP": "0",
                  "BCX": "0"
              }
              }

my_price = {"USDT": 0, "GTC": 0, "DOGE": 0, "BTM": 0, "BCX": 0, "XRP": 0}

money_get = 0
money_loss = 0

createVar = locals()

# print("123"+apikey+"dasd"+secretkey)
gate = GateIO(API_URL, apikey, secretkey)

'''
def read_kData(rootpath,coincode,starttime,endtime):
	returnData=pd.DataFrame()
	for yearnum in range(0,int((endtime - starttime).days / 365.25)+1):
		theyear=starttime+dt.timedelta(days=yearnum*365)
		print('yearnum=',yearnum,'  theyear=',theyear)
		filename=rootpath+theyear.strftime('%Y')+'\\'+str(coincode).zfill(6)+'.csv'
        try:
        	rawdata = pd.read_csv(filename, parse_dates = True, index_col = 0, encoding = 'gbk')
        except IOError:
        	raise Exception('IoError when reading dayline data file: ' + filename)
        returndata = pd.concat([rawdata, returndata])
    #清洗数据    
    returndata = returndata.sort_index()
예제 #3
0
파일: Client.py 프로젝트: SaraFarinya/rest
from gateAPI import GateIO

## 填写 apiKey APISECRET
apiKey = 'your api key'
secretKey = 'your api secret'
## address
btcAddress = 'your btc address'

## Provide constants

API_URL = 'data.gate.io'

## Create a gate class instance

gate = GateIO(API_URL, apiKey, secretKey)

# 所有交易对
print(gate.pairs())

## Below, use general methods that query the exchange

# 市场订单参数
# print(gate.marketinfo())

# 交易市场详细行情
# print(gate.marketlist())

# 所有交易行情
# print(gate.tickers())
# 所有交易对的市场深度
예제 #4
0
파일: gem_Client.py 프로젝트: mktsyy/codes
## 填写 apiKey APISECRET
apiKey = ''
secretKey = ''
## address
btcAddress = 'your btc address'


## Provide constants

API_QUERY_URL = 'data.gateio.io'
API_TRADE_URL = 'api.gateio.io'

## Create a gate class instance

gate_query = GateIO(API_QUERY_URL, apiKey, secretKey)
gate_trade = GateIO(API_TRADE_URL, apiKey, secretKey)


# Trading Pairs
# print(gate_query.pairs())


## Below, use general methods that query the exchange

#  Market Info
# print(gate_query.marketinfo())

# Market Details
# print(gate_query.marketlist())
예제 #5
0
from gateAPI import GateIO

## 填写 apiKey APISECRET
apiKey = 'your api key'
secretKey = 'your api secret'
## address
btcAddress = 'your btc address'

## Provide constants

API_QUERY_URL = 'data.gateio.io'
API_TRADE_URL = 'api.gateio.io'

## Create a gate class instance

gate_query = GateIO(API_QUERY_URL, apiKey, secretKey)
gate_trade = GateIO(API_TRADE_URL, apiKey, secretKey)

# Trading Pairs
print(gate_query.pairs())

## Below, use general methods that query the exchange

#  Market Info
# print(gate_query.marketinfo())

# Market Details
# print(gate_query.marketlist())

# Tickers
# print(gate_query.tickers())
예제 #6
0
from gateAPI import GateIO

## 填写 apiKey APISECRET
apiKey = 'your api key'
secretKey = 'your api secret'
## address
btcAddress = 'your btc address'

## Provide constants

API_QUERY_URL = 'data.gateio.io'
API_TRADE_URL = 'api.gateio.io'

## Create a gate class instance

gate_query = GateIO(API_QUERY_URL, apiKey, secretKey)
gate_trade = GateIO(API_TRADE_URL, apiKey, secretKey)

# Trading Pairs
# print(gate_query.pairs())

## Below, use general methods that query the exchange

#  Market Info
# print(gate_query.marketinfo())

# Market Details
# print(gate_query.marketlist())

# Tickers
# print(gate_query.tickers())
예제 #7
0
파일: Client.py 프로젝트: solidbullet/btc
## 填写 apiKey APISECRET
apiKey = 'CD9CB8EB-D1DE-4AF6-BF0F-B4724E9A1A0D'
secretKey = '1160889547d7cddc7f33432d05a59a4f353030b8840ff3abf3952df947e86ce3'
## address
btcAddress = 'your btc address'


## Provide constants

API_QUERY_URL = 'data.gateio.io'
API_TRADE_URL = 'api.gateio.io'

## Create a gate class instance

gate_query = GateIO(API_QUERY_URL, apiKey, secretKey)
gate_trade = GateIO(API_TRADE_URL, apiKey, secretKey)


# Trading Pairs
#print(gate_query.pairs())


## Below, use general methods that query the exchange

#  Market Info
# print(gate_query.marketinfo())

# Market Details
# print(gate_query.marketlist())
예제 #8
0
## 填写 apiKey APISECRET
apiKey = ''
secretKey = ''
## address
btcAddress = 'your btc address'


## Provide constants

API_QUERY_URL = 'data.gateio.io'
API_TRADE_URL = 'api.gateio.io'

## Create a gate class instance

gate_query = GateIO(API_QUERY_URL, apiKey, secretKey)
gate_trade = GateIO(API_TRADE_URL, apiKey, secretKey)


# Trading Pairs
# print(gate_query.pairs())


## Below, use general methods that query the exchange

#  Market Info
# print(gate_query.marketinfo())

# Market Details
# print(gate_query.marketlist())
예제 #9
0
## 填写 apiKey APISECRET
apiKey = ''
secretKey = ''
## address
btcAddress = 'your btc address'


## Provide constants

API_QUERY_URL = 'data.gateio.io'
API_TRADE_URL = 'api.gateio.io'

## Create a gate class instance

gate_query = GateIO(API_QUERY_URL, apiKey, secretKey)
gate_trade = GateIO(API_TRADE_URL, apiKey, secretKey)


# Trading Pairs
# print(gate_query.pairs())


## Below, use general methods that query the exchange

#  Market Info
# print(gate_query.marketinfo())

# Market Details
# print(gate_query.marketlist())
예제 #10
0
 # 设置策略池
 lst_coin = ['eos_usdt']
 # For回测用,设置初始资金池
 total_pool = 3000.0
 total_count = 0.0
 # Provide constants
 API_QUERY_URL = 'data.gateio.io'
 API_TRADE_URL = 'api.gateio.io'
 log('开始测试...初始资金池为 %d' % total_pool)
 buy_sell_flag = True
 while True:
     try:
         content = ''
         mail_helper = MailHelper(get_conf('my_sender'), get_conf('my_pass'))
         # Create a gate class instance
         gate_query = GateIO(API_QUERY_URL, get_conf('apiKey'), get_conf('secretKey'))
         gate_trade = GateIO(API_TRADE_URL, get_conf('apiKey'), get_conf('secretKey'))
         signal = check_signal(lst_coin[0], get_MA(lst_coin[0], gate_query))
         if signal == 1:
             if not buy_sell_flag:
                 total_pool, content = sell(lst_coin[0], get_ask_bid(lst_coin[0], gate_query), total_count, gate_trade)
                 buy_sell_flag = True
                 total_count = 0.0
                 content = content + log('卖出 %s' % lst_coin[0] + '\n当前持仓为: 【现金】 %.6f, 【%s】 %.6f 个' % (total_pool, lst_coin[0], total_count))
                 mail_helper.sendmail(get_conf('my_user'), get_conf('subject'), content)
             else:
                 log('取消卖出【%s】动作,因为最近已经卖出过' % lst_coin[0] + '\n当前持仓为: 【现金】 %.6f, 【%s】 %.6f 个' % (total_pool, lst_coin[0], total_count))
         elif signal == -1:
             if buy_sell_flag:
                 total_count, content = buy(lst_coin[0], get_ask_bid(lst_coin[0], gate_query), total_pool, gate_trade)
                 buy_sell_flag = False
예제 #11
0
파일: Client.py 프로젝트: AlwaysTyping/rest
#!/usr/bin/python
# -*- coding: utf-8 -*-
# encoding: utf-8

from gateAPI import GateIO

# 填写 APIKEY APISECRET
apikey = 'your api key'
secretkey = 'your api secret'
API_URL = 'data.gate.io'

gate = GateIO(API_URL,apikey,secretkey)


# 所有交易对
print (gate.pairs())


# 市场订单参数
# print (gate.marketinfo())


# 交易市场详细行情
# print (gate.marketlist())


# 所有交易行情
# print (gate.tickers())


# 单项交易行情
예제 #12
0
#!/usr/bin/python
# -*- coding: utf-8 -*-
# encoding: utf-8

from gateAPI import GateIO

# 填写 APIKEY APISECRET
apikey = 'your api key'
secretkey = 'your api secret'
API_URL = 'data.gate.io'

gate = GateIO(API_URL, apikey, secretkey)

# 所有交易对
pairs = gate.pairs()
print(gate.pairs())
for item in pairs:
    print gate.ticker(item)

# 市场订单参数
# print (gate.marketinfo())

# 交易市场详细行情
# print (gate.marketlist())

# 所有交易行情
# print (gate.tickers())

# 单项交易行情
# print (gate.ticker('btc_usdt'))
예제 #13
0
# -*- coding: utf-8 -*-
# encoding: utf-8
'''
Provide user specific data and interact with gate.io
'''
from gateAPI import GateIO
import json

## 填写 apiKey APISECRET
apiKey = 'your apiKey'
secretKey = 'your APISECRET'
## Provide constants
API_QUERY_URL = 'data.gateio.io'
API_TRADE_URL = 'api.gateio.io'
## Create a gate class instance
gate_query = GateIO(API_QUERY_URL, apiKey, secretKey)
gate_trade = GateIO(API_TRADE_URL, apiKey, secretKey)

# Trading Pairs
# print(gate_query.pairs())

## Below, use general methods that query the exchange

#  Market Info
# print(gate_query.marketinfo())

# Market Details
# print(gate_query.marketlist())

# Ticker
# print(gate_query.ticker('eos_usdt'))
예제 #14
0
#try: response = urllib2.urlopen('https://gate.io').read()
#except SocketError as e:
#    if e.errno != errno.ECONNRESET:
#        raise # Not error we are looking for
#    pass # Handle error here.

from gateAPI import GateIO
import time
#import request
import re

# Заполнить APIKEY APISECRET
apikey = 'xxxxxxxx-AF41-472B-AB3A-xxxxxxxF8264'
secretkey = 'xxxxxxxxc889c84a89e567a112949c7c5e743449e47c315ea5aa19d51ff7ebd7'
API_URL = 'data.gate.io'
gate = GateIO(API_URL, apikey, secretkey)

FEE = 0.2
PROFIT = 1.3
USD = 10
B = 8
S = 10
X = 2.5

BTC = 0.001
BAL = 10

while True:
    print('*' * 50)
    print(time.asctime())
예제 #15
0
from gateAPI import GateIO

## 填写 apiKey APISECRET
apiKey = ''
secretKey = ''
## address
btcAddress = 'your btc address'

## Provide constants

API_QUERY_URL = 'data.gateio.io'
API_TRADE_URL = 'api.gateio.io'

## Create a gate class instance

gate_query = GateIO(API_QUERY_URL, apiKey, secretKey)
gate_trade = GateIO(API_TRADE_URL, apiKey, secretKey)

# Trading Pairs
# print(gate_query.pairs())

## Below, use general methods that query the exchange

#  Market Info
# print(gate_query.marketinfo())

# Market Details
# print(gate_query.marketlist())

# Tickers
# print(gate_query.tickers())
예제 #16
0
파일: Client.py 프로젝트: wangxuancong/work
## 填写 apiKey APISECRET
apiKey = '62D1E239-38A3-4029-90EF-4A9CC745B8B6'
secretKey = 'e77cb948be92c6d1ab30e610b3dc2f228aae4ec824c1e0d9f3171728af4a7514'
## address
btcAddress = 'your btc address'


## Provide constants

API_QUERY_URL = 'data.gateio.io'
API_TRADE_URL = 'api.gateio.io'

## Create a gate class instance

gate_query = GateIO(API_QUERY_URL, apiKey, secretKey)
gate_trade = GateIO(API_TRADE_URL, apiKey, secretKey)


# Trading Pairs
print("返回所有系统支持的交易对")
print(gate_query.pairs())


## Below, use general methods that query the exchange

#  Market Info
print("返回所有系统支持的交易市场的参数信息,包括交易费,最小下单量,价格精度等")
print(gate_query.marketinfo())

# Market Details
예제 #17
0
## 填写 apiKey APISECRET
apiKey = Constant.apiKey
secretKey = Constant.secretKey
## address
btcAddress = 'your btc address'


## Provide constants

API_QUERY_URL = Constant.API_QUERY_URL
API_TRADE_URL = Constant.API_TRADE_URL

## Create a gate class instance

gate_query = GateIO(API_QUERY_URL, apiKey, secretKey)
gate_trade = GateIO(API_TRADE_URL, apiKey, secretKey)


# Trading Pairs
# print(gate_query.pairs())


## Below, use general methods that query the exchange

#  Market Info
# print(gate_query.marketinfo())

# Market Details
# print(gate_query.marketlist())
예제 #18
0
파일: Client.py 프로젝트: mktsyy/codes
## 填写 apiKey APISECRET
apiKey = ''
secretKey = ''
## address
btcAddress = 'your btc address'


## Provide constants

API_QUERY_URL = 'data.gateio.io'
API_TRADE_URL = 'api.gateio.io'

## Create a gate class instance

gate_query = GateIO(API_QUERY_URL, apiKey, secretKey)
gate_trade = GateIO(API_TRADE_URL, apiKey, secretKey)


# Trading Pairs
# print(gate_query.pairs())


## Below, use general methods that query the exchange

#  Market Info
# print(gate_query.marketinfo())

# Market Details
# print(gate_query.marketlist())
예제 #19
0
파일: trx_Client.py 프로젝트: mktsyy/codes
## 填写 apiKey APISECRET
apiKey = ''
secretKey = ''
## address
btcAddress = 'your btc address'


## Provide constants

API_QUERY_URL = 'data.gateio.io'
API_TRADE_URL = 'api.gateio.io'

## Create a gate class instance

gate_query = GateIO(API_QUERY_URL, apiKey, secretKey)
gate_trade = GateIO(API_TRADE_URL, apiKey, secretKey)


# Trading Pairs
# print(gate_query.pairs())


## Below, use general methods that query the exchange

#  Market Info
# print(gate_query.marketinfo())

# Market Details
# print(gate_query.marketlist())
예제 #20
0
from telebot import types
import json
import numpy as np
from time import sleep, time
from threading import Thread

TOKEN = 'YOUR BOT TOKEN HERE'  # Ponemos nuestro Token generado con el @BotFather
bot = telebot.TeleBot(
    TOKEN)  # Combinamos la declaración del Token con la función de la API
lastTime = time()
# 填写 APIKEY APISECRET
apikey = 'YOUR gate.io API key'
secretkey = 'YOUR gate.io API secret key'
API_URL = 'data.gate.io'

gate = GateIO(API_URL, apikey, secretkey)

commands = {  # command description used in the "help" command
    '/start': 'Empezar a usar el bot',
    '/help': 'Comandos de ayuda',
    'balance': 'Balance de monedas',
    'valores': 'Cotizaciones',
    '/list': 'Listado monedas',
    'addb <coin>': 'Añade par BTC',
    'adde <coin>': 'Añade par ETH',
    'addu <coin>': 'Añade par USDT',
    'subb <coin>': 'Elimina par BTC',
    'sube <coin>': 'Elimina par ETH',
    'subu <coin>': 'Elimina par USDT'
}
try: