Skip to content

Commit

Permalink
Use yapic.json instead of json for 1.5x to 2x performance gain (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentmele committed Apr 21, 2020
1 parent 1867e44 commit 11ccbff
Show file tree
Hide file tree
Showing 39 changed files with 40 additions and 39 deletions.
2 changes: 1 addition & 1 deletion cryptofeed/backends/elastic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
associated with this software.
'''
import logging
import json
from yapic import json
import itertools

from cryptofeed.backends.http import HTTPCallback
Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/backends/kafka.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
associated with this software.
'''
import asyncio
import json
from yapic import json

from aiokafka import AIOKafkaProducer

Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/backends/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
associated with this software.
'''
from datetime import datetime as dt
import json
from yapic import json

import asyncpg

Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/backends/rabbitmq.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Please see the LICENSE file for the terms and conditions
associated with this software.
'''
import json
from yapic import json
import asyncio

import aio_pika
Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/backends/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Please see the LICENSE file for the terms and conditions
associated with this software.
'''
import json
from yapic import json

import aioredis

Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/backends/socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'''
import logging
import asyncio
import json
from yapic import json
from textwrap import wrap

from cryptofeed.backends.backend import BackendBookCallback, BackendBookDeltaCallback, BackendFundingCallback, BackendTickerCallback, BackendTradeCallback, BackendOpenInterestCallback
Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/backends/zmq.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Please see the LICENSE file for the terms and conditions
associated with this software.
'''
import json
from yapic import json

import zmq
import zmq.asyncio
Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/exchange/binance.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Please see the LICENSE file for the terms and conditions
associated with this software.
'''
import json
from yapic import json
import logging
from decimal import Decimal
from collections import defaultdict
Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/exchange/bitcoincom.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Please see the LICENSE file for the terms and conditions
associated with this software.
'''
import json
from yapic import json
import logging
from decimal import Decimal

Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/exchange/bitfinex.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Please see the LICENSE file for the terms and conditions
associated with this software.
'''
import json
from yapic import json
import logging
from decimal import Decimal
from collections import defaultdict
Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/exchange/bitmax.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Please see the LICENSE file for the terms and conditions
associated with this software.
'''
import json
from yapic import json
import logging
from decimal import Decimal

Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/exchange/bitmex.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Please see the LICENSE file for the terms and conditions
associated with this software.
'''
import json
from yapic import json
import logging
from collections import defaultdict
from decimal import Decimal
Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/exchange/bitstamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Please see the LICENSE file for the terms and conditions
associated with this software.
'''
import json
from yapic import json
import logging
from decimal import Decimal
import asyncio
Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/exchange/bittrex.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging
import json
from yapic import json
from decimal import Decimal
import requests
import zlib
Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/exchange/bybit.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
associated with this software.
'''
import logging
import json
from yapic import json
from decimal import Decimal

from sortedcontainers import SortedDict as sd
Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/exchange/coinbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
associated with this software.
'''
import asyncio
import json
from yapic import json
import logging
from decimal import Decimal
import time
Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/exchange/deribit.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging
import json
from yapic import json
import requests

from cryptofeed.feed import Feed
Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/exchange/dsx.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Please see the LICENSE file for the terms and conditions
associated with this software.
'''
import json
from yapic import json
import logging
from decimal import Decimal

Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/exchange/exx.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Please see the LICENSE file for the terms and conditions
associated with this software.
'''
import json
from yapic import json
import logging
from decimal import Decimal

Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/exchange/ftx.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Please see the LICENSE file for the terms and conditions
associated with this software.
'''
import json
from yapic import json
import logging
from decimal import Decimal

Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/exchange/gemini.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Please see the LICENSE file for the terms and conditions
associated with this software.
'''
import json
from yapic import json
import logging
from decimal import Decimal

Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/exchange/hitbtc.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Please see the LICENSE file for the terms and conditions
associated with this software.
'''
import json
from yapic import json
import logging
from decimal import Decimal

Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/exchange/huobi.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
associated with this software.
'''
import logging
import json
from yapic import json
from decimal import Decimal
import zlib

Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/exchange/huobi_dm.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
'''
import logging
import json
from yapic import json
from decimal import Decimal
import zlib

Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/exchange/kraken.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Please see the LICENSE file for the terms and conditions
associated with this software.
'''
import json
from yapic import json
import logging
from decimal import Decimal

Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/exchange/kraken_futures.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Please see the LICENSE file for the terms and conditions
associated with this software.
'''
import json
from yapic import json
import logging
import requests
from decimal import Decimal
Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/exchange/okcoin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Please see the LICENSE file for the terms and conditions
associated with this software.
'''
import json
from yapic import json
import logging
from decimal import Decimal
import zlib
Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/exchange/poloniex.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Please see the LICENSE file for the terms and conditions
associated with this software.
'''
import json
from yapic import json
import logging
from decimal import Decimal
import time
Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/exchange/upbit.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging
import json
from yapic import json
from decimal import Decimal

import requests
Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/rest/bitfinex.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'''
import time
from time import sleep
import json
from yapic import json
import hashlib
import hmac
import logging
Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/rest/coinbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
associated with this software.
'''
import time
import json
from yapic import json
import hashlib
import hmac
import requests
Expand Down
2 changes: 1 addition & 1 deletion cryptofeed/rest/gemini.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import hashlib
import hmac
import requests
import json
from yapic import json
import base64
import logging
from decimal import Decimal
Expand Down
2 changes: 1 addition & 1 deletion examples/demo_tcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'''
import asyncio
from multiprocessing import Process
import json
from yapic import json
from decimal import Decimal

from cryptofeed.backends.socket import TradeSocket, BookDeltaSocket, BookSocket
Expand Down
2 changes: 1 addition & 1 deletion examples/demo_udp.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'''
from multiprocessing import Process
import socket
import json
from yapic import json

from cryptofeed.backends.socket import TradeSocket, BookSocket, BookDeltaSocket
from cryptofeed import FeedHandler
Expand Down
2 changes: 1 addition & 1 deletion examples/demo_uds.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'''
import asyncio
from multiprocessing import Process
import json
from yapic import json
from decimal import Decimal
import os

Expand Down
2 changes: 1 addition & 1 deletion examples/demo_zmq.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
associated with this software.
'''
from multiprocessing import Process
import json
from yapic import json

from cryptofeed.backends.zmq import BookZMQ, TickerZMQ
from cryptofeed import FeedHandler
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def run_tests(self):
"aiohttp",
"aiodns",
"cchardet",
"aiofile"
"aiofile",
'yapic.json>=1.4.1'
],
extras_require={
'redis': ['aioredis'],
Expand Down
2 changes: 1 addition & 1 deletion tools/check_raw_dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
associated with this software.
'''
import sys
import json
from yapic import json


def main(filename):
Expand Down
2 changes: 1 addition & 1 deletion tools/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'''
from urllib.request import urlopen
import requests
import json
from yapic import json


"""
Expand Down

0 comments on commit 11ccbff

Please sign in to comment.