Skip to content

Commit 9d7ac85

Browse files
committed
imporve readme
1 parent c802f70 commit 9d7ac85

File tree

1 file changed

+145
-143
lines changed

1 file changed

+145
-143
lines changed

README.md

Lines changed: 145 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ client.transfer(address="",amount=0.02,currency="ETH")
547547
client.create_multi_orders([{Order1},{Order2}])
548548
```
549549
***Expected Output***
550-
```javascript
550+
```python
551551
{
552552
"created": [
553553
{
@@ -613,7 +613,7 @@ client.create_multi_orders([{Order1},{Order2}])
613613
client.cancel_multi_orders([{"id":"O0000001"},{"id":"O0000002"}])
614614
```
615615
***Expected Output***
616-
```javascript
616+
```python
617617
{
618618
"canceled": [
619619
{
@@ -666,11 +666,11 @@ client.cancel_multi_orders([{"id":"O0000001"},{"id":"O0000002"}])
666666
To get a Socket connection with CryptoMarket you'll want to use:
667667

668668
```python
669-
client.get_socket()
669+
socket = client.get_socket()
670670
```
671671

672672
Note that **some Socket events requires subscription to a _Market Pair_ to work**, you can do it like this:
673-
673+
**make subscription**
674674
```python
675675
socket.subscribe('ETHCLP')
676676
```
@@ -691,27 +691,27 @@ As you can see, **socket.on** receives two arguments, first you need to provide
691691
**Handler example**
692692

693693
```python
694-
from __future__ import print_function
695694
import json
696695

697696
def handler(data):
698-
print(json.dumps(data, indent= 1))
697+
print(json.dumps(data, indent= 2))
699698
```
700699

701700
### Available Socket events
702701

703702
**Receive open book info**
704703
```python
704+
# subscription required*
705705
socket.on('open-book', handler)
706706
```
707707
Output:
708-
```javascript
709-
open-book {
710-
ETHCLP: {
711-
sell: [
708+
```python
709+
{
710+
"ETHCLP": {
711+
"sell": [
712712
[Order1], [Order2],...
713713
],
714-
buy: [
714+
"buy": [
715715
[Order1], [Order2],...
716716
]
717717
}
@@ -720,88 +720,90 @@ open-book {
720720

721721
**Receive Historical book info**
722722
```python
723+
# subscription required*
723724
socket.on('historical-book', handler)
724725
```
725726
Output:
726-
```javascript
727+
```python
727728
[
728-
ETHCLP:
729-
{
730-
requestId: 'OOETHCLP0000000000000000000001',
731-
tradeId: 'O232937',
732-
stockId: 'ETHCLP',
733-
kind: 1,
734-
type: 2,
735-
side: 1,
736-
price: '204820.000000000000000000000000000000',
737-
limit: null,
738-
condition: null,
739-
flag: 'GENERAL',
740-
amount: '0.00000000000000000000000000000000000',
741-
initAmount: '2.07330000000000000000000000000000000',
742-
dateReceived: 1582205310697,
743-
executed_price: '204820.000000000000000000000000000000',
744-
executed_amount: '2.07330000000000000000000000000000000',
745-
executed_date: 1582205310745
729+
"ETHCLP":
730+
{
731+
"requestId": 'OOETHCLP0000000000000000000001',
732+
"tradeId": 'O232937',
733+
"stockId": 'ETHCLP',
734+
"kind": 1,
735+
"type": 2,
736+
"side": 1,
737+
"price": '204820.000000000000000000000000000000',
738+
"limit": null,
739+
"condition": null,
740+
"flag": 'GENERAL',
741+
"amount": '0.00000000000000000000000000000000000',
742+
"initAmount": '2.07330000000000000000000000000000000',
743+
"dateReceived": 1582205310697,
744+
"executed_price": '204820.000000000000000000000000000000',
745+
"executed_amount": '2.07330000000000000000000000000000000',
746+
"executed_date": 1582205310745
746747
},
747748
{
748-
requestId: 'OOETHCLP0000000000000000000002',
749-
tradeId: 'O232665',
750-
stockId: 'ETHCLP',
751-
kind: 1,
752-
type: 2,
753-
side: 1,
754-
price: '201540.000000000000000000000000000000',
755-
limit: null,
756-
condition: null,
757-
flag: 'GENERAL',
758-
amount: '1.66960000000000000000000000000000000',
759-
initAmount: '1.92640000000000000000000000000000000',
760-
dateReceived: 1582204925623,
761-
executed_price: '201260.000000000000000000000000000000',
762-
executed_amount: '0.256800000000000000000000000000000000',
763-
executed_date: 1582204925645
749+
"requestId": 'OOETHCLP0000000000000000000002',
750+
"tradeId": 'O232665',
751+
"stockId": 'ETHCLP',
752+
"kind": 1,
753+
"type": 2,
754+
"side": 1,
755+
"price": '201540.000000000000000000000000000000',
756+
"limit": null,
757+
"condition": null,
758+
"flag": 'GENERAL',
759+
"amount": '1.66960000000000000000000000000000000',
760+
"initAmount": '1.92640000000000000000000000000000000',
761+
"dateReceived": 1582204925623,
762+
"executed_price": '201260.000000000000000000000000000000',
763+
"executed_amount": '0.256800000000000000000000000000000000',
764+
"executed_date": 1582204925645
764765
}
765766
]
766767
```
767768

768769
**Receive Candles info**
769770
```python
771+
# subscription required*
770772
socket.on('candles', handler)
771773
```
772774
Output:
773-
```javascript
774-
candles: {
775+
```python
776+
{
775777
'buy': {
776778
'1': [
777779
[{
778-
date: '21/02/2020 04:56:00',
779-
stockId: 'ETHCLP',
780-
type: 1,
781-
timeFrame: 1,
782-
lowPrice: 212060,
783-
hightPrice: 212060,
784-
openPrice: 212060,
785-
closePrice: 212100,
786-
count: 3,
787-
volume: 0,
788-
lastBuyPrice: 217900,
789-
lastSellPrice: 227220
790-
}],[Object],...],
791-
'5': [[Object],[Object],...],
792-
'15':[[Object],[Object],...],
793-
'60': [[Object],[Object],...],
794-
'240':[[Object],[Object],...],
795-
'1440':[[Object],[Object],...],
796-
'10080':[[Object],[Object],...],
797-
'44640':[[Object],[Object],...]
798-
}
799-
800-
'sell':{
801-
'1':[[Object],...],
802-
'5':...
803-
},
804-
lastBuyPrice: 218880,lastSellPrice: 227220
780+
"date": '21/02/2020 04:56:00',
781+
"stockId": 'ETHCLP',
782+
"type": 1,
783+
"timeFrame": 1,
784+
"lowPrice": 212060,
785+
"hightPrice": 212060,
786+
"openPrice": 212060,
787+
"closePrice": 212100,
788+
"count": 3,
789+
"volume": 0,
790+
"lastBuyPrice": 217900,
791+
"lastSellPrice": 227220
792+
}], ...],
793+
'5': ...,
794+
'15': ...,
795+
'60': ...,
796+
'240': ...,
797+
'1440': ...,
798+
'10080': ...,
799+
'44640': ...
800+
},
801+
'sell':{
802+
'1':...,
803+
'5':...
804+
},
805+
"lastBuyPrice": 218880,
806+
"lastSellPrice": 227220
805807
}
806808
```
807809

@@ -810,25 +812,25 @@ lastBuyPrice: 218880,lastSellPrice: 227220
810812
socket.on('ticker', handler)
811813
```
812814
Output:
813-
```javascript
814-
ticker: {
815-
EOSARS: {
816-
BID: 346.95,
817-
ASK: 364.65,
818-
delta1d: -13.04511278195489,
819-
delta7d: -21.928442844284426
815+
```python
816+
{
817+
"EOSARS": {
818+
"BID": 346.95,
819+
"ASK": 364.65,
820+
"delta1d": -13.04511278195489,
821+
"delta7d": -21.928442844284426
820822
},
821-
BTCCLP: {
822-
BID: 7914600,
823-
ASK: 8038600,
824-
delta1d: -2.4334319526627217,
825-
delta7d: -2.1318164956102383
823+
"BTCCLP": {
824+
"BID": 7914600,
825+
"ASK": 8038600,
826+
"delta1d": -2.4334319526627217,
827+
"delta7d": -2.1318164956102383
826828
},
827-
ETHCLP: {
828-
BID: 213600,
829-
ASK: 218880,
830-
delta1d: 1.0598031794095382,
831-
delta7d: 0.6692430954849656
829+
"ETHCLP": {
830+
"BID": 213600,
831+
"ASK": 218880,
832+
"delta1d": 1.0598031794095382,
833+
"delta7d": 0.6692430954849656
832834
},
833835
...
834836
}
@@ -839,18 +841,18 @@ ticker: {
839841
socket.on('balance', handler)
840842
```
841843
Output:
842-
```javascript
843-
balance: {
844-
ETH: {
845-
currency: 'ETH',
846-
countable: '0.0700000000000000000000000000000000000',
847-
available: '0.0700000000000000000000000000000000000',
848-
currency_kind: 1,
849-
currency_name: 'ETH',
850-
currency_big_name: 'Ether',
851-
currency_prefix: '',
852-
currency_postfix: ' ETH',
853-
currency_decimals: 4
844+
```python
845+
{
846+
"ETH": {
847+
"currency": 'ETH',
848+
"countable": '0.0700000000000000000000000000000000000',
849+
"available": '0.0700000000000000000000000000000000000',
850+
"currency_kind": 1,
851+
"currency_name": 'ETH',
852+
"currency_big_name": 'Ether',
853+
"currency_prefix": '',
854+
"currency_postfix": ' ETH',
855+
"currency_decimals": 4
854856
},
855857
...
856858
}
@@ -861,23 +863,23 @@ balance: {
861863
socket.on('open-orders', handler)
862864
```
863865
Output:
864-
```javascript
865-
open-orders [
866+
```python
867+
[
866868
{
867-
requestId: 'OOXLMCLP0000000000000000000001',
868-
tradeId: 'O000001',
869-
traderId: '2',
870-
stockId: 'XLMCLP',
871-
kind: 2,
872-
type: 2,
873-
side: 2,
874-
price: '80.0000000000000000000000000000000000',
875-
limit: null,
876-
condition: null,
877-
flag: 'GENERAL',
878-
amount: '1.00000000000000000000000000000000000',
879-
initAmount: '1.00000000000000000000000000000000000',
880-
dateReceived: 1582301424510
869+
"requestId": 'OOXLMCLP0000000000000000000001',
870+
"tradeId": 'O000001',
871+
"traderId": '2',
872+
"stockId": 'XLMCLP',
873+
"kind": 2,
874+
"type": 2,
875+
"side": 2,
876+
"price": '80.0000000000000000000000000000000000',
877+
"limit": null,
878+
"condition": null,
879+
"flag": 'GENERAL',
880+
"amount": '1.00000000000000000000000000000000000',
881+
"initAmount": '1.00000000000000000000000000000000000',
882+
"dateReceived": 1582301424510
881883
},
882884
{Order2},...
883885
]
@@ -888,23 +890,23 @@ open-orders [
888890
socket.on('historical-orders', handler)
889891
```
890892
Output:
891-
```javascript
892-
historical-orders [
893+
```python
894+
[
893895
{
894-
requestId: 'OOXLMCLP000000000000000000001',
895-
tradeId: 'O000001',
896-
traderId: '1',
897-
stockId: 'XLMCLP',
898-
kind: 2,
899-
type: 2,
900-
side: 2,
901-
price: '50.5000000000000000000000000000000000',
902-
limit: null,
903-
condition: null,
904-
flag: 'GENERAL',
905-
amount: '0.00000000000000000000000000000000000',
906-
initAmount: '1.00000000000000000000000000000000000',
907-
dateReceived: 1582261738700
896+
"requestId": 'OOXLMCLP000000000000000000001',
897+
"tradeId": 'O000001',
898+
"traderId": '1',
899+
"stockId": 'XLMCLP',
900+
"kind": 2,
901+
"type": 2,
902+
"side": 2,
903+
"price": '50.5000000000000000000000000000000000',
904+
"limit": null,
905+
"condition": null,
906+
"flag": 'GENERAL',
907+
"amount": '0.00000000000000000000000000000000000',
908+
"initAmount": '1.00000000000000000000000000000000000',
909+
"dateReceived": 1582261738700
908910
},
909911
{Order2},...
910912
]
@@ -914,13 +916,13 @@ historical-orders [
914916
socket.on('operated', handler)
915917
```
916918
Output:
917-
```javascript
918-
operated {
919-
flag: 'L0',
920-
threshold: '0.00000000000000000000000000000000000',
921-
traded: '0.0718085391503182500000000000000000000',
922-
tk: '0.00680000000000000000000000000000000000',
923-
mk: '0.00390000000000000000000000000000000000'
919+
```python
920+
{
921+
"flag": 'L0',
922+
"threshold": '0.00000000000000000000000000000000000',
923+
"traded": '0.0718085391503182500000000000000000000',
924+
"tk": '0.00680000000000000000000000000000000000',
925+
"mk": '0.00390000000000000000000000000000000000'
924926
}
925927
```
926928

0 commit comments

Comments
 (0)