Compare Prices STEEM Bittrex, Poloniex and CoinmarketcapsteemCreated with Sketch.

in #programming7 years ago (edited)

Today we are  going to do something quite simple that will bring us closer to the  Automatic Trading, the process of comparison of the different markets  !!!

We can make decisions on whether a  currency will go up or down according to certain factors, but the  Comparison Factor of the different markets should be fundamental, clear  as we do not want to be all day on the computer watching if it goes up  or down and run away to sell Is stressful we are  going to continue with my Automatic Trading System, but this you see we  will only compare the prices of @bittrex @poloniex and @cointmarketcap


For this entry  we will only see STEEM prices and we are going to build a table with the  data that we are getting, I do not want to overwhelm them and for that  reason we will only get 1 line in the table that will be the prices of  the moment:


To extract the value of STEEM in Bittrex I will use this link:

https://bittrex.com/api/v1.1/public/getticker?market=BTC-STEEM

To extract the Value of STEEM in Poloniex I will use this link:

https://poloniex.com/public?command=returnOrderBook&currencyPair=BTC_STEEM&depth=1 

To extract the Value of STEEM in Coinmarketcap I will use this link:

https://coinmarketcap-nexuist.rhcloud.com/api/steem/price
 

Although for Bittrex we could use this link:

https://bittrex.com/api/v1.1/public/getmarkethistory?market=BTC-STEEM 

What I'm really interested in is the price of Bids more than the Ask, I explain a little:

The Bids price is what people are bidding to buy the currency or stock.
The Ask price is the price at which other people are selling.

Generally  the ASKs will be higher than the Bids, so in other entries placed what  we have invested that is given by the ASK and what we have in the  Reality Price Bids but this is not so well, even if we wanted to  speculate a little we could Take an intermediate value and see if we sell. But that is beyond what I want to do in this POST.

For example note to Poloniex:

asks 

     "0.00065373"

         172.62933522 

bids

     "0.00065000"

         19.95676913 

In this example we have the Price of STEEM in BTC which is where we  are interested right now ... And then we see other things that have  occurred to me but I do not want to overwhelm them ...

We have a price of 0.00065373 for each STEEM but they will only sell us 172.62933522. And also 0.00065000 for each STEEM but we are only going to buy 19.95676913.

That is why the Bids are what we are interested in, although later we  will see how ASK prices are the ones that also move the market.

Now  that we know what data we are interested in, only the prices of Bids  proceed to remove them, Recall that Coinmarketcap does not have Bids or  Ask only Price ...

The  program is going to connect to each Link and take the data of the  prices Bids and will allow us to know where is more expensive STEEM  which is the Difference in% and this will give us an idea if we should  sell or buy in the future or even Will allow us to change these currencies between Platforms to obtain  better Profits. Of course, taking into account the commissions that this  implies, but we will see this later.


Here I leave part of the script:

#!/usr/bin/env python

# -*- coding: utf-8 -*-

from bittrex import Bittrex

import urllib2

from bs4 import BeautifulSoup

import re

from prettytable import PrettyTable

lista_bitrex = []

lista_bitrex_poloniex = []

lista_bitrex_coinmarket = []

lista_poloniex = []

lista_poloniex_bitrex = []

lista_poloniex_coinmarket = []

lista_coinmarket = []

dictionary_data = {}

#VALUE BTC bittrex

url = "https://bittrex.com/api/v1.1/public/getticker?market=USDT-BTC"

page = urllib2.urlopen(url)

soup = BeautifulSoup(page, "lxml")

valor = soup.find_all('p')

valor = valor[0].get_text()

valor = eval(valor.replace('true','True'))

Bid_valor = valor['result']['Bid']

Bid_valor_bitt = float(Bid_valor)

dictionary_data['price_BTC_bittrex'] = Bid_valor_bitt

#VALUE STEEM bittrex

url = "https://bittrex.com/api/v1.1/public/getticker?market=BTC-STEEM"

page = urllib2.urlopen(url)

soup = BeautifulSoup(page, "lxml")

valor = soup.find_all('p')

valor = valor[0].get_text()

valor = eval(valor.replace('true','True'))

Bid_valor = valor['result']['Bid']

Bid_valor_bitt = float(Bid_valor)

dictionary_data['price_steem_bittrex'] = Bid_valor_bitt

dictionary_data['price_steem_bittrex_usd'] = Bid_valor_bitt * dictionary_data['price_BTC_bittrex']

#VALUE BTC poloniex

url = "https://poloniex.com/public?command=returnOrderBook&currencyPair=USDT_BTC&depth=1"

page = urllib2.urlopen(url)

soup = BeautifulSoup(page, "lxml")

valor = soup.find_all('p')

valor = valor[0].get_text()

valor = eval(valor.replace('true','True'))

Bid_valor = valor['bids']

Bid_valor_polo = float(Bid_valor[0][0])

dictionary_data['price_BTC_poloniex'] = Bid_valor_polo

#VALUE STEEM poloniex

url = "https://poloniex.com/public?command=returnOrderBook&currencyPair=BTC_STEEM&depth=1"

page = urllib2.urlopen(url)

soup = BeautifulSoup(page, "lxml")

valor = soup.find_all('p')

valor = valor[0].get_text()

valor = eval(valor.replace('true','True'))

Bid_valor = valor['bids']

Bid_valor_polo = float(Bid_valor[0][0])

dictionary_data['price_steem_poloniex'] = Bid_valor_polo

dictionary_data['price_steem_poloniex_usd'] = Bid_valor_polo * dictionary_data['price_BTC_poloniex']

#VALUE STEEM coinmarketcap

url = "https://coinmarketcap-nexuist.rhcloud.com/api/btc/price"

page = urllib2.urlopen(url)

soup = BeautifulSoup(page, "lxml")

valor = soup.find_all('p')

valor = valor[0].get_text()

valor = eval(valor.replace('true','True'))

Bid_valor = valor['usd']

Bid_valor_coin = float(Bid_valor)

dictionary_data['price_BTC_coinmarket'] = Bid_valor_coin

#VALUE STEEM coinmarketcap

url = "https://coinmarketcap-nexuist.rhcloud.com/api/steem/price"

page = urllib2.urlopen(url)

soup = BeautifulSoup(page, "lxml")

valor = soup.find_all('p')

valor = valor[0].get_text()

valor = eval(valor.replace('true','True'))

Bid_valor = valor['btc']

Bid_valor_coin = float(Bid_valor)

dictionary_data['price_steem_coinmarket'] = Bid_valor_coin

dictionary_data['price_steem_coinmarket_usd'] = Bid_valor_coin * dictionary_data['price_BTC_coinmarket']

print ""

print ""

print ""

print "STEEM"

table_bid = PrettyTable([u'Bitrex Price', u'Poloniex Price', u'Coinmarket Price'])

table_bid.add_row([

                    dictionary_data['price_steem_bittrex_usd'],

                    dictionary_data['price_steem_poloniex_usd'],

                    dictionary_data['price_steem_coinmarket_usd']

                    ])

print table_bid

print ""

print ""

print ""

print "BTC"

table_bid_btc = PrettyTable([u'Bitrex Price', u'Poloniex Price', u'Coinmarket Price'])

table_bid_btc.add_row([

                    dictionary_data['price_BTC_bittrex'],

                    dictionary_data['price_BTC_poloniex'],

                    dictionary_data['price_BTC_coinmarket']

                    ])

print table_bid_btc

Y esta es la Salida:

STEEM

+--------------+----------------+------------------+

| Bitrex Price | Poloniex Price | Coinmarket Price |

+--------------+----------------+------------------+

|  1.1160528   | 1.11784437881  |   1.1295288264   |

+--------------+----------------+------------------+




BTC

+--------------+----------------+------------------+

| Bitrex Price | Poloniex Price | Coinmarket Price |

+--------------+----------------+------------------+

|    4240.0    | 4245.99984356  |     4265.85      |


Already  many will understand that this is a job a little complicated but that  will pay off with the Favor and the Blessing of God ...  Until the next :D


Sort:  

get your ledger wallet before it gets more expensive, this crypto-currency revolution is a life time movement and is here to stay trust me.

https://www.ledgerwallet.com/r/8efa

Coin Marketplace

STEEM 0.17
TRX 0.15
JST 0.027
BTC 60678.52
ETH 2339.38
USDT 1.00
SBD 2.48