Skip to content

Instantly share code, notes, and snippets.

@KolevDarko
Created June 16, 2017 08:12
Show Gist options
  • Save KolevDarko/b01a02231ea6e5973997013911b63b0d to your computer and use it in GitHub Desktop.
Save KolevDarko/b01a02231ea6e5973997013911b63b0d to your computer and use it in GitHub Desktop.
def main(exchange, starting_price, amount, currency, limit_type, limit):
"""
:param exchange: The exchange where bitcoin was bought
:param starting_price: The price at which bitcoin was bought
:param amount: The amount of bitcoin
:param currency: The currency bitcoin was bought in
:param limit_type: The type of threshold, percent or amount
:param limit: The value of the threshold
:return: Current profit made
"""
API_ROOT = "https://apiv2.bitcoinaverage.com"
response = requests.get("{api}/exchanges/{exchange}".format(api=API_ROOT, exchange=exchange), headers={'X-Signature': create_signature()})
symbol = 'BTC'+currency
latest_bid = response.json()['symbols'][symbol]['bid']
result = calculate_profits(currency, latest_bid, starting_price, amount, limit_type, limit)
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment