Exchange Wash Trading and Mutual Brushing
Python strategy by apple7474.
PythonOther
The original spec has no written description. Read the source below.
Parameters
| Name | Default | What it controls |
|---|---|---|
| nnum | 5 | Quantity |
| pprice | 3 | Price |
| trade_num | 5 | Number of Trades |
| Button | Default | Description |
| ---- | ---- | ---- |
| Start | __button__ | Start volume brushing |
Source Python
def main():
# Set exchange address
exchanges[0].SetBase("")
exchanges[1].SetBase("")
Log("Waiting for instructions")
while True:
LogStatus(_D())
cmd = GetCommand()
if cmd:
arr = cmd.split(":")
# Number of Trades
for i in range(trade_num):
Account0 = exchanges[0].GetAccount()
Account1 = exchanges[1].GetAccount()
# Log("Account0-usdt", Account0["Balance"], "Account0-DEC", Account0["Stocks"])
# Log("Account 1-usdt", Account1["Balance"], "Account1-DEC", Account1["Stocks"])
# Get the coins of A0 and A1
A0_stocks = Account0["Stocks"]
A1_stocks = Account1["Stocks"]
error = 0
if A0_stocks > A1_stocks:
Log("Account0There are coins")
# Reset index
ex_chang = [exchanges[0], exchanges[1]]
if abstest(A0_stocks, A1_stocks) == 1:
break
else:
# Log("Can continue trading")
pass
else:
Log("Account1Yesdec")
# Reset index
ex_chang = [exchanges[1], exchanges[0]]
if abstest(A0_stocks, A1_stocks) == 1:
break
else:
# Log("Can continue trading")
pass
# 0Index always sells
ex_chang[0].Sell(pprice, nnum)
# 1Index always sells
ex_chang[1].Buy(pprice, nnum)
Log("Transaction completed",i)
Sleep(5)
if abstest(A0_stocks, A1_stocks) == 1:
break
else:
# Log("Can continue trading")
pass
Log("Run finished")
def abstest(a, b):
# Simple judgment
abs_value = abs(a - b)
# Log("Currency difference:" + str(abs_value))
if abs_value == 0:
Log("Insufficient coins, please check")
error = 1
else:
# Log("Can continue trading")
error = 0
return error
Published by apple7474 on the FMZ strategy square · last modified 2021-07-14. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.
Build this with AgenKit
A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Exchange-Wash-Trading-and-Mutual-Brushing.md- npx agenkit install engineering-kit in your project
- Paste the command into your agent and approve each phase
- Get tests, backtest, risk controls and a paper-trading switch
Understand it first
Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.
Related specs
- Dynamic Balancing Strategy Python VersionPython · Other
- Leek Protection Program Tang Anqi Channel Position Balancing StrategyPython · Other
- Paul The Gambler Lévy Gold EditionPython · Other
- Porting OKCoin Leek Harvester Multi Variety Version Annotated Python VersionPython · Other
- Python Example Using asyncio http to Obtain Market DataPython · Other
- Python Version of MACD Indicator Drawing ExamplePython · Other