Trading advice from a python script by chitty

View this thread on steempeak.com
· @chitty · (edited)
$22.14
Trading advice from a python script
This is a simple python script that retrieves current Steem Dollar price from Poloniex and tells you whether to buy, sell or hold!

```
from urllib.request import urlopen
import json

url = urlopen('https://poloniex.com/public?command=returnTicker').read()
result = json.loads(url)

SBD = result['BTC_SBD']['last']
BTC = result['USDT_BTC']['last']
SBD_USD = float(SBD) * float(BTC)

print "SBD $",'{0:.2f}'.format(SBD_USD)
SBD = '{0:.2f}'.format(SBD_USD)
SBD = float(SBD)
if SBD > 1:
  print 'sell, sell.. we are riaaach $$$!!'
elif SBD < 0.90:
  print 'buy!!'
else:
  print 'hoooodl !!!'

```

You can run it online [here]( https://trinket.io/python/783312bb2d)

Or, If you have a raspberry pi and a sense hat you could even tweak it so it shows on your screen, [like this](https://trinket.io/python/b601da5709):

[![](https://s3.postimg.org/y38ujtb83/raspi.png)](https://trinket.io/python/b601da5709)

*Note: the advice given represents my personal strategy, the idea is to take advantage of the price swings of SBD, please do not take it too seriously.*

#steemdollars
#raspberrypi
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 72 others
properties (23)
post_id646,373
authorchitty
permlinktrading-advice-from-a-python-script
categorypython
json_metadata"{"links": ["https://trinket.io/python/783312bb2d"], "tags": ["python", "steemdollars", "raspberrypi"]}"
created2016-08-17 20:33:51
last_update2016-08-17 21:28:57
depth0
children7
net_rshares10,730,095,298,208
last_payout2016-09-18 00:16:45
cashout_time1969-12-31 23:59:59
total_payout_value20.028 SBD
curator_payout_value2.108 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length1,084
author_reputation84,463,031,858,396
root_title"Trading advice from a python script"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (136)
@aaseb ·
I don't really understand it but I'm guessing it's not just telling you to buy under 90 cents and sell above a dollar. Could you explain a bit how float works?
properties (22)
post_id646,501
authoraaseb
permlinkre-chitty-trading-advice-from-a-python-script-20160817t204238466z
categorypython
json_metadata"{"tags": ["python"]}"
created2016-08-17 20:42:42
last_update2016-08-17 20:42:42
depth1
children2
net_rshares0
last_payout2016-09-18 00:16:45
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length159
author_reputation470,134,608,167
root_title"Trading advice from a python script"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@chitty ·
$0.03
hehe that is exactly what it is telling you... its very simple, mostly for fun and learning how to program on python.
👍  
properties (23)
post_id646,638
authorchitty
permlinkre-aaseb-re-chitty-trading-advice-from-a-python-script-20160817t205032891z
categorypython
json_metadata"{"tags": ["python"]}"
created2016-08-17 20:50:33
last_update2016-08-17 20:50:33
depth2
children1
net_rshares103,891,042,008
last_payout2016-09-18 00:16:45
cashout_time1969-12-31 23:59:59
total_payout_value0.026 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length117
author_reputation84,463,031,858,396
root_title"Trading advice from a python script"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (1)
@aaseb ·
oh ok then I thought there was something more complex going on.
properties (22)
post_id647,397
authoraaseb
permlinkre-chitty-re-aaseb-re-chitty-trading-advice-from-a-python-script-20160817t214212130z
categorypython
json_metadata"{"tags": ["python"]}"
created2016-08-17 21:42:15
last_update2016-08-17 21:42:15
depth3
children0
net_rshares0
last_payout2016-09-18 00:16:45
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length63
author_reputation470,134,608,167
root_title"Trading advice from a python script"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@spiz0r ·
It is really simple, but funny! :)
properties (22)
post_id646,584
authorspiz0r
permlinkre-chitty-trading-advice-from-a-python-script-20160817t204752327z
categorypython
json_metadata"{"tags": ["python"]}"
created2016-08-17 20:47:51
last_update2016-08-17 20:47:51
depth1
children0
net_rshares0
last_payout2016-09-18 00:16:45
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length34
author_reputation2,279,175,552,324
root_title"Trading advice from a python script"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@wwwmmm ·
Artuido motheboard ?
properties (22)
post_id647,146
authorwwwmmm
permlinkre-chitty-trading-advice-from-a-python-script-20160817t212449735z
categorypython
json_metadata"{"tags": ["python"]}"
created2016-08-17 21:24:57
last_update2016-08-17 21:24:57
depth1
children1
net_rshares0
last_payout2016-09-18 00:16:45
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length20
author_reputation-344,085,733,826
root_title"Trading advice from a python script"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@chitty ·
$0.03
Yeah It should work on an arduino too
👍  
properties (23)
post_id647,168
authorchitty
permlinkre-wwwmmm-re-chitty-trading-advice-from-a-python-script-20160817t212632299z
categorypython
json_metadata"{"tags": ["python"]}"
created2016-08-17 21:26:33
last_update2016-08-17 21:26:33
depth2
children0
net_rshares106,307,275,558
last_payout2016-09-18 00:16:45
cashout_time1969-12-31 23:59:59
total_payout_value0.027 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length37
author_reputation84,463,031,858,396
root_title"Trading advice from a python script"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (1)
@royalmacro ·
would you please, provide me a php script ?
properties (22)
post_id651,800
authorroyalmacro
permlinkre-chitty-trading-advice-from-a-python-script-20160818t051731371z
categorypython
json_metadata"{"tags": ["python"]}"
created2016-08-18 05:17:27
last_update2016-08-18 05:17:27
depth1
children0
net_rshares0
last_payout2016-09-18 00:16:45
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length43
author_reputation181,970,085,860,999
root_title"Trading advice from a python script"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000