The stock market is clouded: newcomers die from chasing high, old hands die from copying. The issue is a matter of timing, one carelessly gets locked up, so many strategies will do some trend prediction, adjusting the holding situation according to the trend.
For fixed investment strategies, the fundamental core of fixed investment strategies is to keep buying high and selling low and buying more and more, rather than chasing down and down.
Developing an effective betting strategy that can significantly increase the returns of the bet, we should put our plans on paper before the bet, execute according to the plan, reduce human intervention, stick to it, stop the loss, to really realize the value of the bet.
Here, we limit the scope of our operations to control the risk by formulating the following strategic rules:
The game is played with one empty hand per minute and 20 double levers. Odd position, if the loss is more than 3%, continue to hold; if the profit is more than 3%, hold 2 hands per minute In this case, in the test script, the betting cycle, the number of bets, the leverage multiplier, the profit and loss ratio, the position direction are configurable.
If you are interested in this strategy, please contact +V:Irene11229 (Click on my homepage, I'll keep updating more strategies, and also get market analysis data from some of the top exchanges)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import json import time from kumex.client import Trade class Aip(object): def __init__(self): # read configuration from json file with open('config.json', 'r') as file: config = json.load(file) self.api_key = config['api_key'] self.api_secret = config['api_secret'] self.api_passphrase = config['api_passphrase'] self.sandbox = config['is_sandbox'] self.symbol = config['symbol'] self.timer = int(config['timer']) self.size = int(config['size']) self.side = config['side'] self.leverage = config['leverage'] self.rate = float(config['rate']) self.trade = Trade(self.api_key, self.api_secret, self.api_passphrase, is_sandbox=self.sandbox) if self.side == 'sell': self.close = 'buy' else: self.close = 'sell' def get_position_pcnt(self): position = self.trade.get_position_details(self.symbol) return float(position['unrealisedPnlPcnt']) if __name__ == '__main__': aip = Aip() market_order = aip.trade.create_market_order(aip.symbol, aip.side, aip.leverage, type='market', size=aip.size) print('create a market %s order, order id = %s' % (aip.side, market_order['orderId'])) while 1: time.sleep(aip.timer * 60) pcnt = aip.get_position_pcnt() if pcnt < 0 and abs(pcnt) > aip.rate: market_order = aip.trade.create_market_order(aip.symbol, aip.side, aip.leverage, type='market', size=aip.size) print('create a market %s order, order id = %s' % (aip.side, market_order['orderId'])) elif pcnt > 0 and pcnt > aip.rate: market_order = aip.trade.create_market_order(aip.symbol, aip.close, aip.leverage, type='market', size=(aip.size*2)) print('create a market %s order, order id = %s' % (aip.close, market_order['orderId']))
SethIt's simple and easy to understand, try it.
gulishiduan_high frequency orderingIt seems simple and effective.