bitstamp – Bitstamp reference

WebSocket

This package has classes for the events emitted by Bitstamp’s streaming service. Check https://www.bitstamp.net/websocket/ for more information.

class pyalgotrade.bitstamp.wsclient.OrderBookUpdate(dateTime, eventDict)

Bases: pyalgotrade.websocket.pusher.Event

An order book update event.

getAskPrices()

Returns a list with the top 20 ask prices.

getAskVolumes()

Returns a list with the top 20 ask volumes.

getBidPrices()

Returns a list with the top 20 bid prices.

getBidVolumes()

Returns a list with the top 20 bid volumes.

getDateTime()

Returns the datetime.datetime when this event was received.

class pyalgotrade.bitstamp.wsclient.Trade(dateTime, eventDict)

Bases: pyalgotrade.websocket.pusher.Event

A trade event.

getAmount()

Returns the trade amount.

getDateTime()

Returns the datetime.datetime when this event was received.

getId()

Returns the trade id.

getPrice()

Returns the trade price.

Client

class pyalgotrade.bitstamp.client.Client

Bases: pyalgotrade.observer.Subject

This class is responsible for the interaction with Bitstamp. In order to get the client running it has to be included in the dispatch loop. Check the example code to get this done.

getOrderBookUpdateEvent()

Returns the event that will be emitted as new trades are received from Bitstamp. To subscribe to this event you need to pass in a callable object that receives one parameter:

  1. A pyalgotrade.bitstamp.wsclient.OrderBookUpdate instance.
getTradeEvent()

Returns the event that will be emitted as new trades are received from Bitstamp. To subscribe to this event you need to pass in a callable object that receives one parameter:

  1. A pyalgotrade.bitstamp.wsclient.Trade instance.

Note

It is not necessary to manually subscribe to this event since trades are notified by the BarFeed.

Feeds

class pyalgotrade.bitstamp.barfeed.LiveTradeFeed(client, maxLen=1024)

Bases: pyalgotrade.barfeed.BaseBarFeed

A real-time BarFeed that builds bars from live trades.

Parameters:

Note

Note that a Bar will be created for every trade, so open, high, low and close values will all be the same.

Brokers

class pyalgotrade.bitstamp.broker.PaperTradingBroker(cash, barFeed, fee=0.005)

Bases: pyalgotrade.broker.backtesting.Broker

A Bitstamp paper trading broker.

Parameters:
  • cash (int/float.) – The initial amount of cash.
  • barFeed (pyalgotrade.barfeed.BarFeed) – The bar feed that will provide the bars.
  • fee (float.) – The fee percentage for each order. Defaults to 0.5%.

Note

Only limit orders are supported.

Table Of Contents

Previous topic

Bitstamp support

Next topic

Bitstamp Example

This Page