Skip to content

Commit

Permalink
add first example that will place simple Smart Trade
Browse files Browse the repository at this point in the history
  • Loading branch information
devops398 committed Apr 2, 2020
1 parent 42f35f4 commit 82d2da0
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,6 @@ dmypy.json

# Pyre type checker
.pyre/

# Idea
.idea
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
# trading-bot-example
# trading-bot-example

Simple example of own trading bot running on your computer or own cloud, using Cryptocurrencies.AI for more advanced execution

### Installation

```
$ git clone [email protected]:Cryptocurrencies-AI/trading-bot-example.git
$ cd trading-bot
$ pip3 install -r requirements.txt
$ python3 trade.py
```

### Deployment

// todo
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ccai-client==0.0.3
42 changes: 42 additions & 0 deletions trade.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from ccai.client import Client

def test_create_smart_order():
# create simple smart order that will entry by market and exit with 15% profit
# or exit at 10% loss

client = Client('SECRET',
'KEYID')
smart_order = {
"marketType": 1, # 0 - spot, 1 - futures
"pair": "BTC_USDT",
"stopLoss": 10.0, # 7% loss
"stopLossType": "market", # will place stop-limit or stop-market
"leverage": 30, # leverage
"entryOrder": {
"side": "buy",
"orderType": "limit",
"price": 6300,
"type": 0, # not using yet, just place 0
"amount": 0.001 # btc amount
},
"exitLevels": [
{
"price": 15, # 15% profit
"amount": 100, # 70% from entry
"type": 1, # 1 - means amount and price is in percentage
"orderType": "limit"
}
]
}
response = client.create_order(params=smart_order)
print(response)

def test_get_balances():
client = Client('SECRET',
'KEID')
response = client.get_balances()
print(response)

#test_create_smart_order()
#test_get_balances()
test_create_smart_order()

0 comments on commit 82d2da0

Please sign in to comment.