-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4b462ea
commit aba83be
Showing
7 changed files
with
93 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright (c) 2017 Thijs Triemstra and contributors | ||
# See LICENSE.rst for details. | ||
|
||
""" | ||
Endpoint for bitstamp.net | ||
:see: https://www.bitstamp.net/api/ | ||
""" | ||
|
||
from datetime import datetime | ||
|
||
from dateutil.tz.tz import tzutc | ||
|
||
from . import Endpoint, EndpointResponse | ||
|
||
|
||
class BitstampResponse(EndpointResponse): | ||
|
||
def parse_price(self): | ||
return float(self.json_data.get('last')) | ||
|
||
def parse_price_in_btc(self): | ||
return 1 | ||
|
||
def parse_timestamp(self): | ||
return datetime.fromtimestamp( | ||
int(self.json_data.get('timestamp')), tz=tzutc()) | ||
|
||
|
||
class Bitstamp(Endpoint): | ||
api_version = 'v2' | ||
responseType = BitstampResponse | ||
|
||
def get_url(self): | ||
base = 'https://www.bitstamp.net/api/{api_version}/ticker/btc{currency}/' | ||
|
||
return base.format( | ||
currency=self.currency_code.lower(), | ||
api_version=self.api_version | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
luma/cryptocurrency/reference/endpoint/bitstamp/v2/supported-currencies.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[ | ||
{ | ||
"currency": "EUR", | ||
"country": "Euro" | ||
}, | ||
{ | ||
"currency": "USD", | ||
"country": "United States Dollar" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"high": "1250.71", | ||
"last": "1103.20", | ||
"timestamp": "1489722313", | ||
"bid": "1101.33", | ||
"vwap": "1187.63", | ||
"volume": "16303.35767789", | ||
"low": "1101.00", | ||
"ask": "1103.49", | ||
"open": "1172.00" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters