Login Page - Create Account

Support Board


Date/Time: Mon, 25 Nov 2024 07:54:11 +0000



Post From: Sharing script for downloading quotes data from Bitstamp

[2024-03-27 22:06:17]
SviCh - Posts: 40
Decided to share my Python script for everyone interested.

Downloader used to accumulate historical ticks data from Bitstamp on a daily basis. Can also be
used to get real-time time if executed frequently enough. But in this case make sure you limit
your calls to 600 requests per 10 minutes, or risk getting your IP banned.
To just accumulate historical ticks, this script should be executed at least 2 times per day (eg
with cron) in order not to miss any data, because Bitstamp gives only 24 hours of ticks.

Usage: python create_scid_files.py <SierraChart_data_directory> <crypto_pairs_list_file> [volume_multiplier]

volume_multiplier defaults to 10000 if omitted (as SierraChart does for bitcoin)
(see Cryptocurrency / Bitcoin Data and Trading Services for
fractional volumes)

The script matches last 5 ticks to find a place where to truncate new data appending to old.
It is done because with 1 second precision like we have at Bitstamp we may get situation of the
same time and price, though different trade (and we are cannot write trade_id to scid to solve
this in common way)

Details on particular fields of each tick:
According to doc Intraday Data File Format
If a data record represents one single tick/trade, then the Intraday data record Open, High, Low, and Close can be set to the same value and you will write one record for every tick/trade.
if you want to record the Bid and Ask price for the trade, then set the Open to 0, the High to the Ask price, the Low to the Bid price, and the Close to the trade price.
By examining different scid files, I noticed if bid and ask for tick is unknown, open, high, low, close are set to the same value. Else close is 0.
Bitstamp also provides information whether trade is buy (`type` field is 0) or sell (`type` field is 1). This gets reflected in bid/ask volume.
attachmentbitstamp_downloader.py - Attached On 2024-03-27 22:04:04 UTC - Size: 7.21 KB - 248 views