|
13 | 13 | # Amount of coins to buy
|
14 | 14 | amount = 10
|
15 | 15 | # How big of a profit you want to make
|
16 |
| -multiplier = 1.02 + (2*fee) |
| 16 | +your_profit = 1.03 |
| 17 | +multiplier = your_profit + (2*fee) |
17 | 18 |
|
18 | 19 | # Getting the ETH price for DGB
|
19 | 20 | dgbsummary = api.getmarketsummary(market)
|
20 |
| -dgbprice = dgbsummary[0]['Last']*0.995 |
21 |
| -print 'The price for {0} is {1:.8f} {2}.'.format(currency, dgbprice, trade) |
| 21 | +dgbprice_last = dgbsummary[0]['Last'] |
| 22 | +print 'The price for {0} is {1:.8f} {2}.'.format(currency, dgbprice_last, trade) |
22 | 23 |
|
23 | 24 | # Buying 10 DGB for ETH
|
24 |
| -print 'Buying {0} {1} for {2:.8f} {3}.'.format(amount, currency, dgbprice, trade) |
25 |
| -api.buylimit(market, amount, dgbprice) |
| 25 | +dgbprice_buy = ( dgbprice * 0.995 ) |
| 26 | +print 'Buying {0} {1} for {2:.8f} {3}.'.format(amount, currency, dgbprice_buy, trade) |
| 27 | +api.buylimit(market, amount, dgbprice_buy) |
26 | 28 |
|
27 | 29 | # Multiplying the price by the multiplier
|
28 |
| -dgbprice = round(dgbprice*multiplier, 8) |
| 30 | +dgbprice_sell = round(dgbprice_buy*multiplier, 8) |
29 | 31 |
|
30 | 32 | # Selling 9.98 DGB for the new price
|
31 |
| -print 'Selling {0} {1} for {2:.8f} {3}.'.format(amount, currency, dgbprice, trade) |
32 |
| -api.selllimit(market, amount, dgbprice*(1-(2*fee))) |
| 33 | +print 'Selling {0} {1} for {2:.8f} {3}.'.format(amount, currency, dgbprice_sell, trade) |
| 34 | +api.selllimit(market, amount, dgbprice_sell) |
33 | 35 |
|
34 | 36 | # Gets the DGB balance
|
35 | 37 | dgbbalance = api.getbalance(currency)
|
|
0 commit comments