config items
This commit is contained in:
parent
1a41c23203
commit
ef99063dae
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"exchanges": {
|
||||
"binance": {
|
||||
"currency": "USDT",
|
||||
"minimum_amount_in_trading_account": 1000,
|
||||
"step_size": 500,
|
||||
"percentage": 0.5,
|
||||
"time_between_subscriptions": 3600,
|
||||
"time_between_redemptions": 0
|
||||
},
|
||||
"gateio": {
|
||||
"currency": "USDT",
|
||||
"minimum_amount_in_trading_account": 1000,
|
||||
"step_size": 500,
|
||||
"percentage": 0.5,
|
||||
"time_between_subscriptions": 3600,
|
||||
"time_between_redemptions": 0
|
||||
},
|
||||
"kucoin": {
|
||||
"currency": "USDT",
|
||||
"minimum_amount_in_trading_account": 1000,
|
||||
"step_size": 500,
|
||||
"percentage": 0.5,
|
||||
"time_between_subscriptions": 3600,
|
||||
"time_between_redemptions": 0
|
||||
},
|
||||
"okx": {
|
||||
"currency": "USDT",
|
||||
"minimum_amount_in_trading_account": 1000,
|
||||
"step_size": 500,
|
||||
"percentage": 0.5,
|
||||
"time_between_subscriptions": 3600,
|
||||
"time_between_redemptions": 0
|
||||
}
|
||||
},
|
||||
"lap_time": 10
|
||||
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
'''
|
||||
https://github.com/binance/binance-connector-python/blob/master/binance/spot/_simple_earn.py
|
||||
|
||||
'''
|
||||
|
||||
from credentials import get_api_key
|
||||
from binance.spot import Spot as Client
|
||||
from binance.error import ClientError
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
https://www.okx.com/docs-v5/en/#financial-product-simple-earn-flexible
|
||||
|
||||
https://github.com/okxapi/python-okx/blob/master/okx/Earning.py
|
||||
|
||||
'''
|
||||
|
||||
import okx.Earning as Earning
|
||||
|
|
|
|||
114
main.py
114
main.py
|
|
@ -3,85 +3,53 @@ from libraries.wrappers import earn_binance
|
|||
from libraries.wrappers import earn_kucoin
|
||||
from libraries.wrappers import earn_okx
|
||||
from libraries.wrappers import earn_gateio
|
||||
from threading import Thread
|
||||
import time
|
||||
import json
|
||||
|
||||
kucoin = earn_kucoin.kucoin_earn()
|
||||
binance = earn_binance.binance_earn()
|
||||
okx = earn_okx.okx_earn()
|
||||
gateio = earn_gateio.gateio_earn()
|
||||
class earner:
|
||||
def __init__(self, connector, config):
|
||||
self.connector = connector
|
||||
self.currency = config["currency"]
|
||||
self.minimum_amount_in_trading_account = config["minimum_amount_in_trading_account"]
|
||||
self.step_size = config["step_size"]
|
||||
self.percentage = config["percentage"]
|
||||
self.time_between_subscriptions = config["time_between_subscriptions"]
|
||||
self.time_between_redemptions = config["time_between_redemptions"]
|
||||
|
||||
self.last_subscription = 0
|
||||
self.last_redemption = 0
|
||||
|
||||
def __str__(self):
|
||||
return f"Earner for {self.connector} with {self.currency} and {self.minimum_amount_in_trading_account} minimum amount in trading account and {self.step_size} step size and {self.percentage} percentage"
|
||||
|
||||
def run(self):
|
||||
print(self)
|
||||
|
||||
|
||||
if __name__=="__main__":
|
||||
|
||||
'''
|
||||
Subscribe workflow in Binance:
|
||||
1. Get product id
|
||||
2. Subscribe
|
||||
|
||||
Redeem workflow in Binance
|
||||
1. Redeem with the same product id
|
||||
'''
|
||||
#print(binance.get_available_products("USDT"))
|
||||
#print(binance.subscribe_product("USDT001", "10", auto_subscribe=False))
|
||||
#print(binance.get_position("USDT"))
|
||||
#print(binance.redeem_product("USDT001", amount="10"))
|
||||
|
||||
|
||||
|
||||
'''
|
||||
Subscribe workflow in Kucoin
|
||||
1. Get product id
|
||||
2. Subscribe
|
||||
|
||||
Redeem workflow in Kucoin
|
||||
1. Get ORDER id (the order id of the position)
|
||||
2. Redeem
|
||||
'''
|
||||
#print(kucoin.get_available_products("USDT"))
|
||||
#print(kucoin.subscribe_product("2152", "10"))
|
||||
#print(kucoin.get_position("USDT"))
|
||||
#print(kucoin.redeem_product(order_id="2987632", amount="10"))
|
||||
|
||||
|
||||
'''
|
||||
Subscribe workflow in OKX
|
||||
1. Transfer funds to funding account
|
||||
2. Confirm transfer via transfer_id
|
||||
3. Subscribe
|
||||
|
||||
Redeem workflow in OKX
|
||||
1. Reddem product (with coin, no id is required)
|
||||
2. Transfer funds to trading account
|
||||
3. Confirm transfer via transfer_id
|
||||
|
||||
'''
|
||||
#print(okx.get_available_products("USDT"))
|
||||
#print(okx.transfer_to_funding("USDT","10"))
|
||||
#print(okx.get_transfer_state("1064667293"))
|
||||
#print(okx.subscribe_product("USDT", "10"))
|
||||
#print(okx.get_position("USDT"))
|
||||
#print(okx.redeem_product("USDT", "10"))
|
||||
#print(okx.transfer_to_trading("USDT", "10"))
|
||||
#print(okx.get_transfer_state("1064667720"))
|
||||
|
||||
|
||||
'''
|
||||
Subscribe workflow in Gate.io
|
||||
1. Get minimum rate
|
||||
2. Subscribe product
|
||||
3. Use get_account to confirm (request returns error?)
|
||||
|
||||
Redeem workflow in Gate.io
|
||||
1. Reddem product
|
||||
2. Use get_account to confirm (request returns error?)
|
||||
'''
|
||||
|
||||
#print(gateio.get_min_rate("USDT"))
|
||||
#print(gateio.subscribe_product("USDT", "10", "0.00000452"))
|
||||
#print(gateio.get_position("USDT"))
|
||||
#print(gateio.redeem_product("USDT", "10"))
|
||||
|
||||
pass
|
||||
with open("config.json") as f:
|
||||
config = json.load(f)
|
||||
|
||||
connectors = {"binance": earn_binance.binance_earn(),
|
||||
"gateio": earn_gateio.gateio_earn(),
|
||||
"kucoin": earn_kucoin.kucoin_earn(),
|
||||
"okx": earn_okx.okx_earn()}
|
||||
earners = []
|
||||
|
||||
for item in config["exchanges"]:
|
||||
earners.append(earner(connectors[item], config["exchanges"][item]))
|
||||
|
||||
while True:
|
||||
threads = []
|
||||
for item in earners:
|
||||
threads.append(Thread(target=item.run))
|
||||
for item in threads:
|
||||
item.start()
|
||||
for item in threads:
|
||||
item.join()
|
||||
|
||||
time.sleep(config["lap_time"])
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,67 @@
|
|||
'''
|
||||
Subscribe workflow in Binance:
|
||||
1. Get product id
|
||||
2. Subscribe
|
||||
|
||||
Redeem workflow in Binance
|
||||
1. Redeem with the same product id
|
||||
'''
|
||||
#print(binance.get_available_products("USDT"))
|
||||
#print(binance.subscribe_product("USDT001", "10", auto_subscribe=False))
|
||||
#print(binance.get_position("USDT"))
|
||||
#print(binance.redeem_product("USDT001", amount="10"))
|
||||
|
||||
|
||||
|
||||
'''
|
||||
Subscribe workflow in Kucoin
|
||||
1. Get product id
|
||||
2. Subscribe
|
||||
|
||||
Redeem workflow in Kucoin
|
||||
1. Get ORDER id (the order id of the position)
|
||||
2. Redeem
|
||||
'''
|
||||
#print(kucoin.get_available_products("USDT"))
|
||||
#print(kucoin.subscribe_product("2152", "10"))
|
||||
#print(kucoin.get_position("USDT"))
|
||||
#print(kucoin.redeem_product(order_id="2987632", amount="10"))
|
||||
|
||||
|
||||
'''
|
||||
Subscribe workflow in OKX
|
||||
1. Transfer funds to funding account
|
||||
2. Confirm transfer via transfer_id
|
||||
3. Subscribe
|
||||
|
||||
Redeem workflow in OKX
|
||||
1. Reddem product (with coin, no id is required)
|
||||
2. Transfer funds to trading account
|
||||
3. Confirm transfer via transfer_id
|
||||
|
||||
'''
|
||||
#print(okx.get_available_products("USDT"))
|
||||
#print(okx.transfer_to_funding("USDT","10"))
|
||||
#print(okx.get_transfer_state("1064667293"))
|
||||
#print(okx.subscribe_product("USDT", "10"))
|
||||
#print(okx.get_position("USDT"))
|
||||
#print(okx.redeem_product("USDT", "10"))
|
||||
#print(okx.transfer_to_trading("USDT", "10"))
|
||||
#print(okx.get_transfer_state("1064667720"))
|
||||
|
||||
|
||||
'''
|
||||
Subscribe workflow in Gate.io
|
||||
1. Get minimum rate
|
||||
2. Subscribe product
|
||||
3. Use get_account to confirm (request returns error?)
|
||||
|
||||
Redeem workflow in Gate.io
|
||||
1. Reddem product
|
||||
2. Use get_account to confirm (request returns error?)
|
||||
'''
|
||||
|
||||
#print(gateio.get_min_rate("USDT"))
|
||||
#print(gateio.subscribe_product("USDT", "10", "0.00000452"))
|
||||
#print(gateio.get_position("USDT"))
|
||||
#print(gateio.redeem_product("USDT", "10"))
|
||||
Loading…
Reference in New Issue