semvec/pypi-packages huggingface dataset:
loophopper 0.10
A "fast-forward and rewind" custom iterator for flexible traversal through iterables
License: MIT
Keywords: fast-forward,rewind,loop


# A "fast-forward and rewind" custom iterator for flexible traversal through iterables 

## Tested against Windows / Python 3.11 / Anaconda

## pip install loophopper

```python
from loophopper import FFIter
# Create an FFIter object for a range iterable
l = FFIter(range(40), ignore_exceptions=True, exception_replacement=None)
for no in l:
	if no % 10 == 0:
		print(f"number: {no}, 2 forward: {l.forward(2)}")
	if no % 7 == 0:
		print(f"number: {no}, 1 back: {l.back(1)}")

# Create an FFIter object for a dictionary iterable
l = FFIter(
	{k: k * 2 for k in range(40)}, ignore_exceptions=True, exception_replacement=None
)
for no in l:
	if no[0] % 10 == 0:
		print(f"number: {no}, 2 forward: {l.forward(2)}")
	if no[1] % 7 == 0:
		print(f"number: {no}, 1 back: {l.back(1)}")

l = FFIter(
	{k: k * 2 for k in range(40)}, ignore_exceptions=True, exception_replacement=None
)
for no in l:
	if l.active_index%5==0:
		print(f'{l.active_index}: {no}')

# number: 0, 2 forward: 2
# number: 0, 1 back: None
# number: 7, 1 back: 6
# number: 10, 2 forward: 12
# number: 14, 1 back: 13
# number: 20, 2 forward: 22
# number: 21, 1 back: 20
# number: 28, 1 back: 27
# number: 30, 2 forward: 32
# number: 35, 1 back: 34
# number: (0, 0), 2 forward: (2, 4)
# number: (0, 0), 1 back: None
# number: (7, 14), 1 back: (6, 12)
# number: (10, 20), 2 forward: (12, 24)
# number: (14, 28), 1 back: (13, 26)
# number: (20, 40), 2 forward: (22, 44)
# number: (21, 42), 1 back: (20, 40)
# number: (28, 56), 1 back: (27, 54)
# number: (30, 60), 2 forward: (32, 64)
# number: (35, 70), 1 back: (34, 68)
# 0: (0, 0)
# 5: (5, 10)
# 10: (10, 20)
# 15: (15, 30)
# 20: (20, 40)
# 25: (25, 50)
# 30: (30, 60)
# 35: (35, 70)

```
cryptofeed-werks 0.1.6
WebSocket subclasses, and experiments, for data from cryptocurrency exchanges
License: MIT
Requires Python: >=3.8,<4.0
Keywords: cryptocurrency,trading

# What?

This is the basis of a pipeline for live data from cryptocurrency exchanges. It normalizes [cryptofeed](https://github.com/bmoscon/cryptofeed) WebSocket messages, aggregates, and optionally publishes them to GCP Pub/Sub.

# How?

Sequences of trades that have equal symbol, timestamp, and tick rule are aggregated. Aggregating trades in this way can increase information, as they are either orders of size or stop loss cascades.

As well, the number of messages can be reduced by 30-50%

By filtering aggregated messages, for example only emitting a mesage when an aggregated trade is greater than or equal to a `significant_trade_filter`, the number of messages can be reduced more.

Example
-------
The following are two sequential aggregated trades by timestamp, nanoseconds, and tick rule.

As it was aggregated from 4 raw trades, the second trade has ticks 4.

```python
[
    {
        "timestamp": 1620000915.31424,
        "price": "57064.01",
        "volume": "566.6479018604",
        "notional": "0.00993004",
        "tickRule": -1,
        "ticks": 1
    },
    {
        "timestamp": 1620000915.885381,
        "price": "57071.2",
        "volume": "9376.6869202914",
        "notional": "0.16429813",
        "tickRule": 1,
        "ticks": 4
    }
]
```

An example filtered message, emitted because the second aggregated trade exceeds `significant_trade_filter >= 1000`

Information related to the first trade is aggregated with the second.

```python
[
    {
        "timestamp": 1620000915.885381,
        "price": "57071.2",
        "volume": "9376.6869202914",
        "notional": "0.16429813",
        "tickRule": 1,
        "ticks": 4,
        "high": '57071.2',
        "low": '57064.01',
        "totalBuyVolume": "9376.6869202914",
        "totalVolume": "9943.3348221518",
        "totalBuyNotional": "0.16429813",
        "totalNotional": "0.17422817",
        "totalBuyTicks": 4,
        "totalTicks": 5
    }
]
```

For 1m, 5m, 15m candles, there is an optional parameter `window_seconds`.  

For settings, see the [examples](https://github.com/globophobe/cryptofeed-werks/blob/main/examples/)

Supported exchanges
-------------------

:white_check_mark: Binance

:white_check_mark: Bitfinex

:white_check_mark: Bitflyer

:white_check_mark: BitMEX

:white_check_mark: Bybit

:white_check_mark: Coinbase Pro

:white_check_mark: Upbit

Contributing
------------

Install dependencies with `poetry install`. The docker example is built with [invoke tasks](https://github.com/globophobe/cryptofeed-werks/blob/master/tasks.py). For example, `invoke build`

Future plans
------------
Order book aggregation, in the manner of [crypto-whale-watching-app](https://github.com/pmaji/crypto-whale-watching-app)