Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create make target 'requirements' to deal with pkg-resources bug caused by ubuntu passing incorrect metadata to pip (see link). pypa/pip#4022
- Loading branch information
Showing
4 changed files
with
36 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,6 @@ mongo: | |
test: | ||
pytest --cov=exchanges | ||
|
||
requirements: | ||
pip freeze | grep -v "pkg-resources" > requirements.txt | ||
|
Empty file.
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,30 @@ | ||
import requests | ||
import json | ||
import pprint | ||
import asyncio | ||
import websocket | ||
|
||
|
||
class CCWebSocket: | ||
ws_protocol = 'wss' | ||
ws_host = 'streamer.cryptocompare.com' | ||
|
||
def __init__(self): | ||
self.url = f'{self.ws_protocol}://{self.ws_host}' | ||
self.ws = websockets | ||
def add_sub(self): | ||
sub_string = {'subs':['0~Poloniex~BTC~USD']} | ||
self.ws.send(json.dumps(sub_string)) | ||
self.ws.run_forever() | ||
|
||
def stream(self): | ||
self.ws = websocket.WebSocketApp(self.url, | ||
on_message=self._handle_message, | ||
on_error=self._handle_message) | ||
|
||
|
||
def _handle_message(self, ws, msg): | ||
print(msg) | ||
|
||
sock = CCWebSocket() | ||
sock.add_sub() |
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