Blockhouse-app
  • Getting Started
    • SDK - File transfer
    • Trade Data Target Schema
  • Market Data Target Schema
Powered by GitBook
On this page
  • Installation
  • Sending Full Trade Data
  1. Getting Started

Trade Data Target Schema

To ensure the send_trade method supports a fully structured schema for trade data input, including all fields from the R8fin Trade Data schema.


Installation

Install the SDK using pip:

pip install blockhouse==1.0.16

Sending Full Trade Data

The send_trade method supports sending complete trade data based on the R8fin Trade Data schema.

from blockhouse import TradeClient

# Initialize the client
client = TradeClient("f6d8d388f0c3c1479d5b30cb43d5346d")

# Send the trade data
response = client.send_trade(trade_data)

Input Schema

The send_trade method accepts a dictionary containing the following fields:

Column Name

Data Type

Description

trade_date

DATE

The execution trade date.

executiontime

TIMESTAMP

Execution time logged in raw format.

brokerexecutiontime

TIMESTAMP

Time recorded by the broker.

exec_time_et

TIMESTAMP

Execution time in Eastern Time.

recapid

STRING

Record ID for this trade.

orderid

STRING

Order ID associated with the execution.

parentcorrelationorderid

STRING

Parent order ID that links multiple orders.

executionid

STRING

Unique ID for the execution.

firm

STRING

Firm identifier.

client

STRING

Client identifier.

syntheticcontractidentifier

STRING

Identifier for the synthetic contract.

instrument

STRING

Instrument or contract involved in the trade.

syntheticpricemode

STRING

Pricing mode (e.g., Yield).

syntheticticksize

FLOAT

Tick size for the synthetic contract.

syntheticcontractdefinition

STRING

Details of the synthetic contract (e.g., UST 10_YEAR, UST 30_YEAR).

security_type

STRING

Type of security (e.g., C for Cash).

symbol

STRING

The symbol of the product that was executed.

cusip

STRING

CUSIP identifier for the security.

side

STRING

Trade side (B for Buy, S for Sell).

quantity

INT

Quantity of the trade (e.g., 1, 2).

price

FLOAT

Price of the trade.

order_source

STRING

Source of the order (e.g., Other-Core).

broker_id

STRING

Broker identifier.

exchange

STRING

Exchange where the trade was executed.

exchange_route

STRING

Route taken at the exchange.

exchange_endpoint

STRING

Endpoint for the exchange.

exchange_lp

STRING

Liquidity provider at the exchange.

is_aggressive

BOOLEAN

Indicator if the trade was aggressive.

destination

STRING

Destination type (e.g., ICEBERG, SOR).

order_text

STRING

Additional text for the order (e.g., Quote or Hedge description).

quote_or_hedge

STRING

Indicates if the trade is a Quote or Hedge.

hedge_target_price

FLOAT

Target price for the hedge.

cash_exchange_trade_id

STRING

ID of the cash exchange trade.

timestamp

FLOAT

Timestamp of the trade.

build_id

STRING

Build ID associated with the execution.

build_name

STRING

Name of the build.

hide_duration

FLOAT

Duration for which the order was hidden.

pop_ticks

STRING

Ticks associated with the trade population.

label

STRING

Label for the trade (e.g., comp_0: 0.0).

strategy

STRING

The trading strategy applied (e.g., Curve).

Example Usage

from blockhouse import TradeClient

# Initialize the client
client = TradeClient("d713bb69cbdb9c15c2b30c388ebbaf6a")

# Define the full trade data schema
trade_data = {
    "trade_date": "2025-01-15",
    "executiontime": "2025-01-15T10:30:45Z",
    "brokerexecutiontime": "2025-01-15T10:30:50Z",
    "exec_time_et": "2025-01-15T05:30:45-05:00",
    "recapid": "abcd1234",
    "orderid": "12345",
    "parentcorrelationorderid": "67890",
    "executionid": "xyz9876",
    "firm": "BlockhouseTrading",
    "client": "Client123",
    "syntheticcontractidentifier": "Synthetic01",
    "instrument": "UST 10_YEAR",
    "syntheticpricemode": "Yield",
    "syntheticticksize": 0.01,
    "syntheticcontractdefinition": "UST 10_YEAR Synthetic Contract",
    "security_type": "C",
    "symbol": "AAPL",
    "cusip": "037833100",
    "side": "buy",
    "quantity": 100,
    "price": 150.50,
    "order_source": "Other-Core",
    "broker_id": "BRK123",
    "exchange": "NASDAQ",
    "exchange_route": "Direct",
    "exchange_endpoint": "Endpoint123",
    "exchange_lp": "LiquidityProvider1",
    "is_aggressive": True,
    "destination": "SOR",
    "order_text": "Quote description",
    "quote_or_hedge": "Quote",
    "hedge_target_price": 150.00,
    "cash_exchange_trade_id": "CASH123",
    "timestamp": 1673881845.123,
    "build_id": "Build123",
    "build_name": "Release_1.0",
    "hide_duration": 0.5,
    "pop_ticks": "Tick123",
    "label": "comp_0: 0.0",
    "strategy": "Curve"
}

# Send the trade data
response = client.send_trade(trade_data)

# Print the response
print(response)

Response Schema

The send_trade method returns a structured response, adhering to the following schema:

Field Name

Data Type

Description

status

STRING

Indicates success or failure of the operation.

message

STRING

Additional information or status message.

Example Response

Successful API calls return a response similar to the following:

{
    "status": "success",
    "message": "Trade successfully sent to Blockhouse API."
}

PreviousSDK - File transferNextMarket Data Target Schema

Last updated 3 months ago