Skip to content

Commit 1508d3f

Browse files
authored
Update ExampleETHDGB.py
1 parent a43f91f commit 1508d3f

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

ExampleETHDGB.py

+10-8
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,25 @@
1313
# Amount of coins to buy
1414
amount = 10
1515
# 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)
1718

1819
# Getting the ETH price for DGB
1920
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)
2223

2324
# 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)
2628

2729
# Multiplying the price by the multiplier
28-
dgbprice = round(dgbprice*multiplier, 8)
30+
dgbprice_sell = round(dgbprice_buy*multiplier, 8)
2931

3032
# 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)
3335

3436
# Gets the DGB balance
3537
dgbbalance = api.getbalance(currency)

0 commit comments

Comments
 (0)