-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Showing
7 changed files
with
92 additions
and
3 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
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
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,34 @@ | ||
__author__ = "Paulo Antunes" | ||
__copyright__ = "Copyright 2018, XTCryptoSignals" | ||
__credits__ = [ | ||
"Paulo Antunes", | ||
] | ||
__license__ = "GPL" | ||
__maintainer__ = "Paulo Antunes" | ||
__email__ = "[email protected]" | ||
|
||
|
||
from kucoin.client import Client | ||
from kucoin.exceptions import KucoinAPIException | ||
from xtcryptosignals.tasks import settings as s | ||
|
||
|
||
class Kucoin: | ||
def __init__(self): | ||
self.client = Client(s.KUCOIN_API_KEY, s.KUCOIN_API_SECRET, s.KUCOIN_API_PASSPHRASE) | ||
|
||
def get_ticker(self, symbol): | ||
_symbol = "-".join(symbol) | ||
|
||
try: | ||
item = self.client.get_ticker(_symbol) | ||
except (KucoinAPIException, Exception) as err: | ||
raise ValueError(str(err)) | ||
|
||
try: | ||
item.update(self.client.get_24hr_stats(_symbol)) | ||
except (KucoinAPIException, Exception) as err: | ||
raise ValueError(str(err)) | ||
|
||
item.update(ticker=symbol[0]) | ||
return item |
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,38 @@ | ||
__author__ = "Paulo Antunes" | ||
__copyright__ = "Copyright 2018, XTCryptoSignals" | ||
__credits__ = [ | ||
"Paulo Antunes", | ||
] | ||
__license__ = "GPL" | ||
__maintainer__ = "Paulo Antunes" | ||
__email__ = "[email protected]" | ||
|
||
|
||
from marshmallow import ( | ||
fields, | ||
pre_load, | ||
post_load, | ||
) | ||
from xtcryptosignals.tasks.schemas.base import BaseSchema | ||
from xtcryptosignals.tasks import settings as s | ||
|
||
|
||
class Kucoin(BaseSchema): | ||
symbol = fields.Str(required=True) | ||
source = fields.Str(required=True) | ||
last = fields.Float(required=True, attribute="price") | ||
vol = fields.Float(required=True, attribute="volume_24h") | ||
high = fields.Float(required=True, attribute="highest_price_24h") | ||
low = fields.Float(required=True, attribute="lowest_price_24h") | ||
|
||
@pre_load | ||
def pre_load(self, data): | ||
data["source"] = s.KUCOIN | ||
data["symbol"] = data["symbol"].replace("-", "") | ||
data["vol"] = float(data["vol"]) * float(data["last"]) | ||
return data | ||
|
||
@post_load | ||
def post_load(self, data): | ||
super().post_load(data) | ||
return data |
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 |
---|---|---|
|
@@ -8,5 +8,11 @@ | |
__email__ = "[email protected]" | ||
|
||
|
||
BINANCE_API_KEY = "" # Add Personal Binance API KEY | ||
BINANCE_API_SECRET = "" # Add Personal Binance API SECRET | ||
# Add the following Personal Exchange keys in order to be able to Trade | ||
|
||
BINANCE_API_KEY = "" | ||
BINANCE_API_SECRET = "" | ||
|
||
KUCOIN_API_KEY = "" | ||
KUCOIN_API_SECRET = "" | ||
KUCOIN_API_PASSPHRASE = "" |