Skip to main content

Improve performance for handling OHLC against Pandas

Project description

为 OHLC 处理去 pandas 化,从而避免大量的 pandas 内存拷贝,达到性能优化的效果(大概 8000%)。

内部存储为 { "low": [], "high": [] }

可将 ohlc_object[num]['key'] 的调用转化为 ohlc_object['key'][num] 的调用。

init

obj = OHLCObject()
obj['open'] = [1, 2, ...]
obj['high'] = [100, 200, ...]
obj['low'] = [1, 2, ...]
obj['close'] = [100, 200, ...]
obj['timestamp'] = [1498924800000, 1498939200000, ...]
return obj

merge (concat OHLC)

Merge obj2 into obj1, automatically sort using 'timestamp' key

obj1.merge(obj2)

read

obj['low'][1]  # best performance
obj[1]['low']
obj[3:][1]['low']

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ohlcobject-1.2.tar.gz (5.2 kB view details)

Uploaded Source

File details

Details for the file ohlcobject-1.2.tar.gz.

File metadata

  • Download URL: ohlcobject-1.2.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.9

File hashes

Hashes for ohlcobject-1.2.tar.gz
Algorithm Hash digest
SHA256 368f15ca5d6e266d306a7d556608111d17bb54c7d46a8ea85a2901cb96ab7b63
MD5 f41353b788161bff6b0912008825b041
BLAKE2b-256 2cb08919c55d01cd2dfa321365f8cb508a1d0a5cb316dcbd8d045b0b8941cce9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page