[go: up one dir, main page]

0% found this document useful (0 votes)
22 views50 pages

Manual - ProfitDLL en - Us

The ProfitDLL 64 bits User Manual provides detailed information about the DLL and its functionalities for both 32-bit and 64-bit applications, including examples in Delphi, C#, C++, and Python. It outlines the library's communication functions with Routing and Market Data servers, along with the necessary data structures and error codes. Additionally, it describes various exposed functions for managing orders, account information, and server communication, emphasizing the use of callbacks for real-time processing.

Uploaded by

evandrr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views50 pages

Manual - ProfitDLL en - Us

The ProfitDLL 64 bits User Manual provides detailed information about the DLL and its functionalities for both 32-bit and 64-bit applications, including examples in Delphi, C#, C++, and Python. It outlines the library's communication functions with Routing and Market Data servers, along with the necessary data structures and error codes. Additionally, it describes various exposed functions for managing orders, account information, and server communication, emphasizing the use of callbacks for real-time processing.

Uploaded by

evandrr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 50

ProfitDLL 64 bits - User Manual

1. Product Description
The files contained in the zip archive are organized into separate directories for the 64 bit and 32 bit versions.
Each directory has the same file structure. In the directory named DLL and Executable, you can find the
ProfitDLL.dll file for the 32 bit version and ProfitDLL64.dll for the 64 bit version. Additionally, there is a
compiled example in Delphi that can be used to validate the software's functionalities. In the directory named
Interface, files containing the declarations of the functions and types necessary to communicate with the DLL
in Delphi are provided.

There are also examples for 4 different programming languages in the Example folders

Delphi
C#
C++
Python

They contain the source code to use the main functionalities of the product.

2. Library Description
The library provides basic communication functions with the Routing and Market Data servers for developing
32 bit or 64 bit applications. The DLL responds to server events and sends them, processed in real time, to the
client application, primarily through callbacks that will be described in section 3.2.

The following sections describe, in more detail, how the communication between the library and the client
application is carried out, as well as present the technical details of each function or callback.

3. Library Interface The library exposes several functions that are directly called by the client application,
which make requests to the servers or directly to the internal services and structures of the DLL. The
types specified in this documentation are coded in Delphi, with specific examples for other
programming languages in their respective example files.

All the structures necessary to define the library's functions are defined below:
Definitions:

TAssetIDRec = packed record


pwcTicker : PWideChar; // Represents the asset name e.g.: "WDOFUT".
pwcBolsa : PWideChar; // Represents the exchange the asset belongs to e.g.
(for Bovespa): "B".
nFeed : Integer; // Data source 0 (Nelogica), 255 (Other).
end;
PAssetIDRec = ^TAssetIDRec;

TAccountRec = packed record


pwhAccountID : PWideChar; // Account Identifier
pwhTitular : PWideChar; // Account Holder Name
pwhNomeCorretora : PWideChar; // Broker Name
nCorretoraID : Integer; // Broker Identifier
end;
PAccountRec = ^TAccountRec;

// Exchanges
gc_bvBCB = 65; // A
gc_bvBovespa = 66; // B
gc_bvCambio = 68; // D
gc_bvEconomic = 69; // E
gc_bvBMF = 70; // F
gc_bvMetrics = 75; // K
gc_bvCME = 77; // M
gc_bvNasdaq = 78; // N
gc_bvOXR = 79; // O
gc_bvPioneer = 80; // P
gc_bvDowJones = 88; // X
gc_bvNyse = 89; // Y

// Status
CONNECTION_STATE_LOGIN = 0; // Connection to login server
CONNECTION_STATE_ROTEAMENTO = 1; // Connection to routing server
CONNECTION_STATE_MARKET_DATA = 2; // Connection to market data server
CONNECTION_STATE_MARKET_LOGIN = 3; // Login to market data server

LOGIN_CONNECTED = 0; // Login server connected


LOGIN_INVALID = 1; // Login is invalid
LOGIN_INVALID_PASS = 2; // Invalid password
LOGIN_BLOCKED_PASS = 3; // Password locked
LOGIN_EXPIRED_PASS = 4; // Password expired
LOGIN_UNKNOWN_ERR = 200; // Internal login error

ROTEAMENTO_DISCONNECTED = 0;
ROTEAMENTO_CONNECTING = 1;
ROTEAMENTO_CONNECTED = 2;
ROTEAMENTO_BROKER_DISCONNECTED = 3;
ROTEAMENTO_BROKER_CONNECTING = 4;
ROTEAMENTO_BROKER_CONNECTED = 5;
MARKET_DISCONNECTED = 0; // Disconnected from market data server
MARKET_CONNECTING = 1; // Connecting to market data server
MARKET_WAITING = 2; // Waiting for connection
MARKET_NOT_LOGGED = 3; // Not logged in to market data server
MARKET_CONNECTED = 4; // Connected to market data

CONNECTION_ACTIVATE_VALID = 0; // Valid activation


CONNECTION_ACTIVATE_INVALID = 1; // Invalid activation

Error Codes:

NL_OK = Integer($00000000); // OK
NL_INTERNAL_ERROR = Integer($80000001); // Internal error
NL_NOT_INITIALIZED = Integer($80000002); // Not initialized
NL_INVALID_ARGS = Integer($80000003); // Invalid arguments
NL_WAITING_SERVER = Integer($80000004); // Waiting for data from the server

3.1. Exposed Functions

The declarations of all exposed functions are found in this section. Some functions take types containing
"callback" in their name, which will be described in the next subsection.

function DLLInitializeLogin(
const pwcActivationKey : PWideChar;
const pwcUser : PWideChar;
const pwcPassword : PWideChar;
StateCallback : TStateCallback;
HistoryCallback : THistoryCallback;
OrderChangeCallback : TOrderChangeCallback;
AccountCallback : TAccountCallback;
NewTradeCallback : TNewTradeCallback;
NewDailyCallback : TNewDailyCallback;
PriceBookCallback : TPriceBookCallback;
OfferBookCallback : TOfferBookCallback;
HistoryTradeCallback : THistoryTradeCallback;
ProgressCallback : TProgressCallback;
TinyBookCallback : TTinyBookCallback) : Integer; stdcall;

function DLLInitializeMarketLogin(
const pwcActivationKey : PWideChar;
const pwcUser : PWideChar;
const pwcPassword : PWideChar;
StateCallback : TStateCallback;
NewTradeCallback : TNewTradeCallback;
NewDailyCallback : TnewDailyCallback
PriceBookCallback : TPriceBookCallback;
OfferBookCallback : TOfferBookCallback;
HistoryTradeCallback : THistoryTradeCallback;
ProgressCallback : TProgressCallback;
TinyBookCallback : TTinyBookCallback) : Integer; stdcall;

function DLLFinalize: Integer; stdcall;

function SubscribeTicker(pwcTicker : PWideChar; pwcBolsa : PWideChar) : Integer;


stdcall;

function UnsubscribeTicker(pwcTicker : PWideChar; pwcBolsa : PWideChar) : Integer;


stdcall;

function SubscribePriceBook(pwcTicker : PWideChar; pwcBolsa : PWideChar) :


Integer; stdcall;

function UnsubscribePriceBook(pwcTicker : PWideChar; pwcBolsa : PWideChar) :


Integer; stdcall;

function SubscribeOfferBook(pwcTicker : PWideChar; pwcBolsa : PWideChar) :


Integer; stdcall;

function UnsubscribeOfferBook(pwcTicker : PWideChar; pwcBolsa : PWideChar) :


Integer; stdcall;

function GetAgentNameByID(nID : Integer) : PWideChar; stdcall;

function GetAgentShortNameByID(nID : Integer) : PWideChar; stdcall;

function GetAccount : Integer; stdcall;

function SendBuyOrder(
pwcIDAccount : PWideChar;
pwcIDCorretora : PWideChar;
pwcSenha : PWideChar;
pwcTicker : PWideChar;
pwcBolsa : PWideChar;
dPrice : Double;
nAmount : Integer) : Int64; stdcall;

function SendSellOrder(
pwcIDAccount : PWideChar;
pwcIDCorretora : PWideChar;
pwcSenha : PWideChar;
pwcTicker : PWideChar;
pwcBolsa : PWideChar;
dPrice : Double;
nAmount : Integer) : Int64; stdcall;

function SendMarketBuyOrder(
pwcIDAccount : PWideChar;
pwcIDCorretora : PWideChar;
pwcSenha : PWideChar;
pwcTicker : PWideChar;
pwcBolsa : PWideChar;
nAmount : Integer) : Int64; stdcall;
function SendMarketSellOrder(
pwcIDAccount : PWideChar;
pwcIDCorretora : PWideChar;
pwcSenha : PWideChar;
pwcTicker : PWideChar;
pwcBolsa : PWideChar;
nAmount : Integer) : Int64; stdcall;

function SendStopBuyOrder(
pwcIDAccount : PWideChar;
pwcIDCorretora : PWideChar;
pwcSenha : PWideChar;
pwcTicker : PWideChar;
pwcBolsa : PWideChar;
dPrice : Double;
dStopPrice : Double;
nAmount : Integer) : Int64; stdcall;

function SendStopSellOrder(
pwcIDAccount : PWideChar;
pwcIDCorretora : PWideChar;
pwcSenha : PWideChar;
pwcTicker : PWideChar;
pwcBolsa : PWideChar;
dPrice : Double;
dStopPrice : Double;
nAmount : Integer) : Int64; stdcall;

function SendChangeOrder(
pwcIDAccount : PWideChar;
pwcIDCorretora : PWideChar;
pwcSenha : PWideChar;
pwcstrClOrdID : PWideChar;
dPrice : Double;
nAmount : Integer) : Integer; stdcall;

function SendCancelOrder(
pwcIDAccount : PWideChar;
pwcIDCorretora : PWideChar;
pwcClOrdId : PWideChar;
pwcSenha : PWideChar) : Integer; stdcall;

function SendCancelOrders(
pwcIDAccount : PWideChar;
pwcIDCorretora : PWideChar;
pwcSenha : PWideChar;
pwcTicker : PWideChar;
pwcBolsa : PWideChar) : Integer; stdcall;

function SendCancelAllOrders(
pwcIDAccount : PWideChar;
pwcIDCorretora : PWideChar;
pwcSenha : PWideChar) : Integer; stdcall;
function SendZeroPosition(
pwcIDAccount : PWideChar;
pwcIDCorretora : PWideChar;
pwcTicker : PWideChar;
pwcBolsa : PWideChar;
pwcSenha : PWideChar;
dPrice : Double) : Int64; stdcall;

function SendZeroPositionAtMarket(
pwcIDAccount : PWideChar;
pwcIDCorretora : PWideChar;
pwcTicker : PWideChar;
pwcBolsa : PWideChar;
pwcSenha : PWideChar) : Int64; stdcall;

function GetOrders(
pwcIDAccount : PWideChar;
pwcIDCorretora : PWideChar;
dtStart : PWideChar;
dtEnd : PWideChar) : Integer; stdcall;

function GetOrder(pwcClOrdId : PWideChar) : Integer; stdcall;

function GetOrderProfitID(nProfitID : Int64): Integer; stdcall;

function GetPosition(
pwcIDAccount : PWideChar;
pwcIDCorretora : PWideChar;
pwcTicker : PWideChar;
pwcBolsa : PWideChar) : Pointer; stdcall;

function GetHistoryTrades(
const pwcTicker : PWideChar;
const pwcBolsa : PWideChar;
dtDateStart : PWideChar;
dtDateEnd : PWideChar) : Integer; stdcall;

function SetServerAndPort(const strServer, strPort : PWideChar) : Integer;


stdcall;

function GetServerClock (var dtDate : Double; var nYear, nMonth, nDay, nHour,
nMin, nSec, nMilisec: Integer) : Integer; stdcall;

function SetDayTrade(bUseDayTrade : Integer): Integer; stdcall; forward;

function SetEnabledHistOrder(bEnabled : Integer) : Integer; stdcall; forward;

function SetEnabledLogToDebug(bEnabled : Integer) : Integer; stdcall; forward;

function RequestTickerInfo(const pwcTicker : PWideChar; const pwcBolsa :


PWideChar) : Integer; stdcall; forward;

function SubscribeAdjustHistory(pwcTicker : PWideChar; pwcBolsa : PWideChar) :


Integer; stdcall;
function UnsubscribeAdjustHistory(pwcTicker : PWideChar; pwcBolsa : PWideChar) :
Integer; stdcall;

function GetLastDailyClose(const pwcTicker, pwcBolsa: var dClose : Double;


bAdjusted : Integer) : Integer; stdcall;

function SetStateCallback(const a_StateCallback : TStateCallback) : Integer;


stdcall;

function SetAssetListCallback(const a_AssetListCallback : TAssetListCallback) :


Integer; stdcall;

function SetAssetListInfoCallback(const a_AssetListInfoCallback :


TAssetListInfoCallback) : Integer; stdcall;

function SetAssetListInfoCallbackV2(const a_AssetListInfoCallbackV2 :


TAssetListInfoCallbackV2) : Integer; stdcall;

function SetTradeCallback(const a_TradeCallback : TTradeCallback) : Integer;


stdcall;

function SetHistoryTradeCallback(const a_HistoryTradeCallback :


THistoryTradeCallback) : Integer; stdcall;

function SetDailyCallback(const a_DailyCallback : TDailyCallback) : Integer;


stdcall;

function SetTheoreticalPriceCallback(const a_TheoreticalPriceCallback :


TTheoreticalPriceCallback) : Integer; stdcall;

function SetTinyBookCallback(const a_TinyBookCallback : TTinyBookCallback) :


Integer; stdcall;

function SetChangeCotationCallback(const a_ChangeCotation : TChangeCotation) :


Integer; stdcall;

function SetChangeStateTickerCallback(const a_ChangeStateTicker :


TChangeStateTicker) : Integer; stdcall;

function SetSerieProgressCallback(const a_SerieProgressCallback :


TProgressCallback) : Integer; stdcall;

function SetOfferBookCallback(const a_OfferBookCallback : TOfferBookCallback) :


Integer; stdcall;

function SetOfferBookCallbackV2(const a_OfferBookCallbackV2 :


TOfferBookCallbackV2) : Integer; stdcall;

function SetPriceBookCallback(const a_PriceBookCallback : TPriceBookCallback) :


Integer; stdcall;

function SetPriceBookCallbackV2(const a_PriceBookCallbackV2 :


TPriceBookCallbackV2) : Integer; stdcall;
function SetAdjustHistoryCallback(const a_AdjustHistoryCallback :
TAdjustHistoryCallback) : Integer; stdcall;

function SetAdjustHistoryCallbackV2(const a_AdjustHistoryCallbackV2 :


TAdjustHistoryCallbackV2) : Integer; stdcall;

function SetAccountCallback(const a_AccountCallback : TAccountCallback) : Integer;


stdcall;

function SetHistoryCallback(const a_HistoryCallback : THistoryCallback) : Integer;


stdcall;

function SetHistoryCallbackV2(const a_HistoryCallbackV2 : THistoryCallbackV2) :


Integer; stdcall;

function SetOrderChangeCallback(const a_OrderChangeCallback :


TOrderChangeCallback) : Integer; stdcall;

function SetOrderChangeCallbackV2(const a_OrderChangeCallbackV2 :


TOrderChangeCallbackV2) : Integer; stdcall;

DLLInitializeLogin

Name Type Description

const
PWideChar Activation key provided for login
pwcActivationKey

User for login of the account corresponding to


const pwcUser PWideChar
the activation key

const pwcPassword PWideChar Login password

StateCallback TStateCallback Connection state callback

HistoryCallback THistoryCallback Order history callback

OrderChangeCallback TOrderChangeCallback Order state change callback

AccountCallback TAccountCallback Routing account information callback

NewTradeCallback TNewTradeCallback Real-time trades callback

NewDailyCallback TNewDailyCallback Aggregated daily data callback

PriceBookCallback TPriceBookCallback Price market depth information callback

OfferBookCallback TOfferBookCallback Offer book information callback

HistoryTradeCallback THistoryTradeCallback Historical trade data callback

ProgressCallback TProgressCallback Progress callback for some historical request

TinyBookCallback TTinyBookCallback Market depth top-level callback


Function to initialize the Market Data and Routing services of the DLL. It will initialize the connection with all
servers and create the necessary services for communication. Other functions may return the error status
NL_ERR_INIT if DLLInitializeLogin is not successful.

DLLInitializeMarketLogin

Name Type Description

const
PWideChar Activation key provided for login
pwcActivationKey

User for login of the account corresponding to the


const pwcUser PWideChar
activation key

const pwcPassword PWideChar Login password

StateCallback TStateCallback Connection state callback

NewTradeCallback TNewTradeCallback Real-time trades callback

NewDailyCallback TNewDailyCallback Aggregated daily data callback

PriceBookCallback TPriceBookCallback Price market depth information callback

OfferBookCallback TOfferBookCallback Offer book information callback

HistoryTradeCallback THistoryTradeCallback Historical trade data callback

ProgressCallback TProgressCallback Progress callback for some historical request

TinyBookCallback TTinyBookCallback Market depth top-level callback

Equivalent to the DLLInitializeLogin function, but initializes only Market Data services.
DLLFinalize

Function used to terminate the services of the DLL.

SetServerAndPort

Name Type Description

const strServer Double Address of the Market Data server

const strPort Integer Port of the Market Data server

This is used to connect to specific Market Data servers and needs to be called before initialization
(DLLInitialize or InitializeMarket).

Important: Only use this function with guidance from the development team; the DLL operates best by
internally selecting the servers.

GetServerClock

Name Type Description

var dtDate Double Date encoded as Double

var nYear Integer Year

var nMonth Integer Month

var nDay Integer Day

var nHour Integer Hour

var nMin Integer Minute

var nSec Integer Second

var nMilisec Integer Millisecond

Returns the time of the Market Data server; it can only be called after initialization. The parameter dtDate
corresponds to a reference for Double that follows the TDateTime standard of Delphi, as described in
http://docwiki.embarcadero.com/Libraries/Sydney/en/System.TDateTime. The other parameters are also
passed by reference to the caller and represent the calendar date values of the value encoded in the dtDate
parameter.

GetLastDailyClose

Name Type Description

const pwcTicker PWideChar Ticker of the asset


Name Type Description

const pwcBolsa PWideChar Exchange of the asset

var dClose Double Returned closing value of the last session

bAdjusted Integer Indicates whether to adjust the price

The function returns the closing value (dClose) of the candle prior to the current day, according to the
bAdjusted parameter. If bAdjusted is 0, the unadjusted value is returned; otherwise, the adjusted value is
returned.

For the function to return NL_OK with data, SubscribeTicker must have been called previously for the same
asset. On the first call to the function, data is requested from the server, and the function returns
NL_WAITING_SERVER.

All subsequent calls for the same asset return the data already loaded. Invalid assets return
NL_ERR_INVALID_ARGS. If the daily series data or adjustments are not previously loaded, this call will load
them and consequently trigger the progressCallback and adjustHistoryCallback callbacks.

SubscribeTicker

Name Type Description

const pwcTicker PWideChar Ticker of the asset

const pwcBolsa PWideChar Exchange of the asset

This is used to receive real-time quotes for a specific asset. The information is received after subscription as
soon as it becomes available through the callback specified in the NewTradeCallback parameter of the
initialization function. UnsubscribeTicker disables this service.

UnsubscribeTicker

Name Type Description

const pwcTicker PWideChar Ticker of the asset

const pwcBolsa PWideChar Exchange of the asset

Requests the Market Data service to stop sending real-time quotes for a specific asset.

SubscribeOfferBook

Name Type Description

const pwcTicker PWideChar Ticker of the asset


Name Type Description

const pwcBolsa PWideChar Exchange of the asset

This is used to receive real-time information from the order book. The information is received after
subscription as soon as it becomes available through the callback specified in the OfferBookCallback
parameter of the initialization function. UnsubscribeOfferBook disables this service.

UnsubscribeOfferBook

Name Type Description

const pwcTicker PWideChar Ticker of the asset

const pwcBolsa PWideChar Exchange of the asset

Requests the Market Data service to stop sending real-time order book updates for a specific asset.

SubscribePriceBook

Name Type Description

const pwcTicker PWideChar Ticker of the asset

const pwcBolsa PWideChar Exchange of the asset

It is used to receive real-time price market depth information. The information is received after subscription as
soon as it becomes available through the callback specified in the PriceBookCallback parameter of the
initialization function. UnsubscribePriceBook disables this service.

UnsubscribePriceBook

Name Type Description

const pwcTicker PWideChar Ticker of the asset

const pwcBolsa PWideChar Exchange of the asset

Requests the Market Data service to stop sending real-time price market depth updates for a specific asset.

The calls for Subscribe and Unsubscribe SubscribeTicker, UnsubscribeTicker, SubscribePriceBook,


UnsubscribePriceBook, SubscribeOfferBook, UnsubscribeOfferBook receive their parameters in the
following pattern:

Ticker: PETR4, Exchange: B


Ticker: WINFUT, Exchange: F
More examples of exchanges can be found in the declarations section.

SubscribeAdjustHistory

Name Type Description

const pwcTicker PWideChar Ticker of the asset

const pwcBolsa PWideChar Exchange of the asset

This is used to receive the adjustment history for the specified ticker asset. It is necessary to provide the
callback function SetAdjustHistoryCallback or SetAdjustHistoryCallbackV2 to use this subscribe.

UnsubscribeAdjustHistory

Name Type Description

const pwcTicker PWideChar Ticker of the asset

const pwcBolsa PWideChar Exchange of the asset

Requests the Market Data service to stop sending adjustment information for a specific asset.

GetAgentNameByID e GetAgentShortNameByID

Name Type Description

nID Integer Identifier of the trading agent

The returned value provides the full name and abbreviated name of this agent, respectively.

GetHistoryTrades

Name Type Description

const
PWideChar Ticker of the asset
pwcTicker

const
PWideChar Exchange of the asset
pwcBolsa

Start date of the request in the format DD/MM/YYYY HH:mm:SS (mm


dtDateStart PWideChar
= minute, MM = month)

End date of the request in the format DD/MM/YYYY HH:mm:SS (mm =


dtDateEnd PWideChar
minute, MM = month)

This is used to request historical information for an asset starting from a specific date (pwcTicker = 'PETR4';
dtDateStart = '06/08/2018 09:00:00'; dtDateEnd = '06/08/2018 18:00:00'). The return will be given in the
callback function THistoryTradeCallback specified as a parameter in the initialization function. The
TProgressCallback will return the download progress (from 1 to 100), with a progress value of 1000
indicating that all trades have been sent to the client application.

SetDayTrade

Name Type Description

bUseDayTrade Integer Indicates whether to use the day trade flag (1 true, 0 false)

This function is available for clients whose brokers have day trade risk control. Thus, orders are sent with the
DayTrade tag. The parameter is a boolean (0 = False, 1 = True). By setting it to true, all orders will be sent with
day trade mode activated. To deactivate, simply set it to false.

SetEnabledLogToDebug

Name Type Description

bEnabled Integer Indicates whether to save debug logs

Function to determine if the DLL should save logs for debugging (1 = save / 0 = do not save).

RequestTickerInfo

Name Type Description

const pwcTicker PWideChar Ticker of the asset

const pwcBolsa PWideChar Exchange of the asset

This is used to fetch new information about the asset (ex., ISIN). The response is returned in the callbacks
TAssetListInfoCallback, TAssetListInfoCallbackV2, and TAssetListCallback, provided they have
been set in the DLL via the functions SetAssetListInfoCallback, SetAssetListInfoCallbackV2, and
SetAssetListCallback.

The functions below provide a callback address for the DLL to return information. They are optional for using
the library. If they are not specified, the corresponding information will not be provided when requested.

SetChangeCotationCallback

Used to set a callback function of type TChangeCotation, this function notifies whenever the asset undergoes
a price change.

SetAssetListCallback
Used to set a callback function of type TAssetListCallback, which is responsible for returning asset
information.

SetAssetListInfoCallback

Used to set a callback function of type TAssetListInfoCallback, which is responsible for returning asset
information and provides additional details compared to AssetListCallback.

SetAssetListInfoCallbackV2

Similar to SetAssetListInfoCallback, but returns information about the sector, subsector, and segment.

SetChangeStateTickerCallback

Used to set the callback TChangeStateTicker, which informs about changes in the ticker state, such as
whether the asset is in auction, suspended, in pre-closing, after market, or closed.

SetAdjustHistoryCallback

Used to set the callback TAdjustHistoryCallback, which informs about the adjustment history of the ticker.

SetAdjustHistoryCallbackV2

Used to set the callback TAdjustHistoryCallbackV2, which provides information about the adjustment
history of the ticker.

SetTheoreticalPriceCallback

Used to set the callback function of type TTheoreticalPriceCallback, which receives theoretical prices and
quantities during the auction.

SetHistoryCallbackV2

Used to set the callback function of type THistoryCallbackV2, which is similar to THistoryCallback and
receives order history.

SetOrderChangeCallbackV2
Used to set the callback function of type TOrderChangeCallbackV2, which is similar to
TOrderChangeCallback and receives updates about orders.

SetOfferBookCallbackV2

Used to set the callback function of type TOfferBookCallbackV2, which is similar to TOfferBookCallback
and receives the order book in a new format.

SetPriceBookCallbackV2

Used to set the callback function of type TPriceBookCallbackV2, which is similar to TPriceBookCallback
and receives the price market depth in a new format.

SetStateCallback

Used to define the callback function of type TStateCallback. This overrides the callback defined by
DLLInitializeLogin or DLLInitializeMarketLogin.

SetTradeCallback

Used to define the callback function of type TTradeCallback. This overrides the callback defined by
DLLInitializeLogin or DLLInitializeMarketLogin.

SetHistoryTradeCallback

Used to define the callback function of type THistoryTradeCallback. This overrides the callback defined by
DLLInitializeLogin or DLLInitializeMarketLogin.

SetDailyCallback

Used to define the callback function of type TDailyCallback. This overrides the callback defined by
DLLInitializeLogin or DLLInitializeMarketLogin.

SetSerieProgressCallback

Used to define the callback function of type TProgressCallback. This overrides the callback defined by
DLLInitializeLogin or DLLInitializeMarketLogin.

SetOfferBookCallback
Used to define the callback function of type TOfferBookCallback. This overrides the callback defined by
DLLInitializeLogin or DLLInitializeMarketLogin.

SetPriceBookCallback

Used to define the callback function of type TPriceBookCallback. This overrides the callback defined by
DLLInitializeLogin or DLLInitializeMarketLogin.

SetAccountCallback

Used to define the callback function of type TAccountCallback. This overrides the callback defined by
DLLInitializeLogin.

SetHistoryCallback

Used to define the callback function of type THistoryCallback. This overrides the callback defined by
DLLInitializeLogin.

SetOrderChangeCallback

Used to define the callback function of type TOrderChangeCallback. This overrides the callback defined by
DLLInitializeLogin.

The functions described below are only available for initialization with routing after using the
DLLInitializeLogin function during initialization.

GetAccount

Function that returns information about linked accounts through the TAccountCallback passed as a
parameter to the initialization function.

SendBuyOrder

Name Type Description

pwcIDAccount PWideChar Account identifier (provided in GetAccount)

pwcIDCorretora PWideChar Broker identifier (provided in GetAccount)

pwcSenha PWideChar Routing password

pwcTicker PWideChar Ticker of the asset to be traded

pwcBolsa PWideChar Exchange of the asset to be traded


Name Type Description

dPrice Double Target price

nAmount Integer Quantity to be traded

Sends a limit buy order. Returns the internal ID (per session) of the order that can be compared with the
return of THistoryCallback.

SendSellOrder

Name Type Description

pwcIDAccount PWideChar Account identifier (provided in GetAccount)

pwcIDCorretora PWideChar Broker identifier (provided in GetAccount)

pwcSenha PWideChar Routing password

pwcTicker PWideChar Ticker of the asset to be traded

pwcBolsa PWideChar Exchange of the asset to be traded

dPrice Double Target price

nAmount Integer Quantity to be traded

Sends a limit sell order. Returns the internal ID (per session) of the order that can be compared with the return
of THistoryCallback.

SendMarketBuyOrder

Name Type Description

pwcIDAccount PWideChar Account identifier (provided in GetAccount)

pwcIDCorretora PWideChar Broker identifier (provided in GetAccount)

pwcSenha PWideChar Routing password

pwcTicker PWideChar Ticker of the asset to be traded

pwcBolsa PWideChar Exchange of the asset to be traded

nAmount Integer Quantity to be traded

Sends a market buy order. Returns the internal ID (per session) of the order that can be compared with the
return of THistoryCallback.

SendMarketSellOrder
Name Type Description

pwcIDAccount PWideChar Account identifier (provided in GetAccount)

pwcIDCorretora PWideChar Broker identifier (provided in GetAccount)

pwcSenha PWideChar Routing password

pwcTicker PWideChar Ticker of the asset to be traded

pwcBolsa PWideChar Exchange of the asset to be traded

nAmount Integer Quantity to be traded

Sends a market sell order. Returns the internal ID (per session) of the order that can be compared with the
return of THistoryCallback.

SendStopBuyOrder

Name Type Description

pwcIDAccount PWideChar Account identifier (provided in GetAccount)

pwcIDCorretora PWideChar Broker identifier (provided in GetAccount)

pwcSenha PWideChar Routing password

pwcTicker PWideChar Ticker of the asset to be traded

pwcBolsa PWideChar Exchange of the asset to be traded

dPrice Double Target purchase price

dStopPrice Double Stop price

nAmount Integer Quantity to be traded

Sends a stop buy order. Returns the internal ID (per session) of the order that can be compared with the
return of THistoryCallback.

SendStopSellOrder

Name Type Description

pwcIDAccount PWideChar Account identifier (provided in GetAccount)

pwcIDCorretora PWideChar Broker identifier (provided in GetAccount)

pwcSenha PWideChar Routing password

pwcTicker PWideChar Ticker of the asset to be traded

pwcBolsa PWideChar Exchange of the asset to be traded


Name Type Description

dPrice Double Target selling price

dStopPrice Double Stop price

nAmount Integer Quantity to be traded

Sends a stop sell order. Returns the internal ID (per session) of the order that can be compared with the return
of THistoryCallback.

SendChangeOrder

Name Type Description

pwcIDAccount PWideChar Account identifier (provided in GetAccount)

pwcIDCorretora PWideChar Broker identifier (provided in GetAccount)

pwcSenha PWideChar Routing password

ClOrdID of the order to be modified (provided in


pwcstrClOrdID PWideChar
OrderChangeCallback)

dPrice PWideChar Target price after edit

nAmount Integer Quantity after edit

Sends a modification order. When modifying a stop order, the stop price must be provided as the target price,
and the limit price will be calculated based on the same offset.

SendCancelOrder

Name Type Description

pwcIDAccount PWideChar Account identifier (provided in GetAccount)

pwcIDCorretora PWideChar Broker identifier (provided in GetAccount)

ClOrdID of the order to be canceled (provided in


pwcClOrdId PWideChar
OrderChangeCallback)

pwcSenha PWideChar Routing password

Sends a cancellation order. The result of the cancellation request can be monitored in
TOrderChangeCallback.

SendCancelOrders
Name Type Description

pwcIDAccount PWideChar Account identifier (provided in GetAccount)

pwcIDCorretora PWideChar Broker identifier (provided in GetAccount)

pwcSenha PWideChar Routing password

pwcTicker PWideChar Ticker of the asset to be traded

pwcBolsa PWideChar Exchange of the asset to be traded

Sends an order to cancel all orders for an asset. The result of the cancellation request can be monitored in
TOrderChangeCallback for each canceled order.

SendCancelAllOrders

Name Type Description

pwcIDAccount PWideChar Account identifier (provided in GetAccount)

pwcIDCorretora PWideChar Broker identifier (provided in GetAccount)

pwcSenha PWideChar Routing password

Sends an order to cancel all open orders for all assets. The result of the cancellation request can be monitored
in TOrderChangeCallback for each canceled order.

SendZeroPosition

Name Type Description

pwcIDAccount PWideChar Account identifier (provided in GetAccount)

pwcIDCorretora PWideChar Broker identifier (provided in GetAccount)

pwcTicker PWideChar Ticker of the asset to be traded

pwcBolsa PWideChar Exchange of the asset to be traded

pwcSenha PWideChar Routing password

dPrice Double Order price

Sends an order to close the position of a specific asset. Returns the internal ID (per session) of the closing
order, which can be compared with the return of THistoryCallback.

SendZeroPositionAtMarket

Name Type Description


Name Type Description

pwcIDAccount PWideChar Account identifier (provided in GetAccount)

pwcIDCorretora PWideChar Broker identifier (provided in GetAccount)

pwcTicker PWideChar Ticker of the asset to be traded

pwcBolsa PWideChar Exchange of the asset to be traded

pwcSenha PWideChar Routing password

Sends an order to close the position of a specific asset at market value. Returns the internal ID (per session) of
the closing order, which can be compared with the return of THistoryCallback.

GetOrders

Name Type Description

pwcIDAccount PWideChar Account identifier (provided in GetAccount)

pwcIDCorretora PWideChar Broker identifier (provided in GetAccount)

dtStart PWideChar Start date in the format DD/MM/YYYY

dtEnd PWideChar End date in the format DD/MM/YYYY

Function that returns orders within a specified period. The return is made through the callback
THistoryCallback, passed as a parameter to the initialization function.

GetOrder

Name Type Description

pwcClOrdId PWideChar ClOrdID of the order to be returned

Function that returns order data based on a ClOrdID. The return is made through the callback
TOrderChangeCallback, passed as a parameter to the initialization function.

GetOrderProfitID

Name Type Description

nProfitID Int64 ProfitID of the order to be returned

Function that returns order data based on a ProfitID (internal ID per session). The return is made through the
callback TOrderChangeCallback, passed as a parameter to the initialization function. The ProfitID is valid
only during the application's execution, unlike the ClOrdID. This ID is the return from the order sending
functions.
GetPosition

Function that returns the position for a given ticker. It returns a data structure specified below, with a total
size of (91 + N + S + K) bytes:

Field/Description Type Size

Number of accounts Integer 4 bytes

Buffer size Integer 4 bytes

Broker ID Integer 4 bytes

N size of Account string Short 2 bytes

Account string (Array of characters) N bytes

S size of Holder string Short 2 bytes

Holder string (Array of characters) S bytes

K size of Ticker string Short 2 bytes

Ticker string (Array of characters) K bytes

Intraday nQty Integer 4 bytes

Intraday dPrice Double 8 bytes

Day SellAvgPriceToday Double 8 bytes

Day SellQtyToday Integer 4 bytes

Day BuyAvgPriceToday Double 8 bytes

Day BuyQtyToday Integer 4 bytes

Custody Quantity in D+1 Integer 4 bytes

Custody Quantity in D+2 Integer 4 bytes

Custody Quantity in D+3 Integer 4 bytes

Custody Quantity blocked Integer 4 bytes

Custody Pending Quantity Integer 4 bytes

Custody Allocated Quantity Integer 4 bytes

Custody Provisioned Quantity Integer 4 bytes

Custody Position Quantity Integer 4 bytes

Custody Available Quantity Integer 4 bytes

Position Side Byte 1 byte

The field "Position Side" corresponds to an enumerated type described below:


Purchased = 1
Sold = 2
Unknown = 0

SetEnabledHistOrder

This function is used to enable/disable the history and automatic order updates when starting the application
(1 = Enable / 0 = Disable). When the history is disabled, the application will not automatically receive order
data at startup, and calls such as GetPosition, which require the position to be built using operations, will not
return valid results. To disable automatic updates, this function should be called immediately after the
initialization functions. It is important to note that by disabling the history, position control will not be
calculated correctly by the platform, and the functionalities for zeroing positions and order status may be
compromised. The user should be aware of these risks before disabling the history..

3.2 Callbacks

This section describes how each callback function in the library should be declared and its purpose.

Important: Other DLL functions should not be used within a callback.

Callbacks are invoked from the ConnectorThread, meaning they run on a different thread than the main
thread of the client program.

All callback functions must be declared using the stdcall calling convention
(https://en.wikipedia.org/wiki/X86_calling_conventions). This applies to both 32-bit and 64-bit versions.

TStateCallback = procedure(nConnStateType : Integer; nResult : Integer) stdcall;

TProgressCallback = procedure(rAssetID : TAssetIDRec; nProgress : Integer)


stdcall;

TNewTradeCallback = procedure(
rAssetID : TAssetIDRec;
pwcDate : PWideChar;
nTradeNumber : Cardinal;
dPrice : Double;
dVol : Double;
nQtd : Integer;
nBuyAgent : Integer;
nSellAgent : Integer;
nTradeType : Integer;
bEdit : Char) stdcall;

TNewDailyCallback = procedure(
rAssetID : TAssetIDRec;
pwcDate : PWideChar;
dOpen : Double;
dHigh : Double;
dLow : Double;
dClose : Double;
dVol : Double;
dAjuste : Double;
dMaxLimit : Double;
dMinLimit : Double;
dVolBuyer : Double;
dVolSeller : Double;
nQtd : Integer;
nNegocios : Integer;
nContratosOpen : Integer;
nQtdBuyer : Integer;
nQtdSeller : Integer;
nNegBuyer : Integer;
nNegSeller : Integer) stdcall;

TPriceBookCallback = procedure(
rAssetID : TAssetIDRec;
nAction : Integer;
nPosition : Integer;
nSide : Integer;
nQtds : Integer;
nCount : Integer;
dPrice : Double;
pArraySell : Pointer;
pArrayBuy : Pointer) stdcall;

TPriceBookCallbackV2 = procedure(
rAssetID : TAssetIDRec;
nAction : Integer;
nPosition : Integer;
nSide : Integer;
nQtds : Int64;
nCount : Integer;
dPrice : Double;
pArraySell : Pointer;
pArrayBuy : Pointer) stdcall;

TOfferBookCallback = procedure(
rAssetID : TAssetIDRec ;
nAction : Integer;
nPosition : Integer;
Side : Integer;
nQtd : Integer;
nAgent : Integer;
nOfferID : Int64;
dPrice : Double;
bHasPrice : Char;
bHasQtd : Char;
bHasDate : Char;
bHasOfferID : Char;
bHasAgent : Char;
pwcDate : PWideChar;
pArraySell : Pointer
pArrayBuy : Pointer) stdcall;
TOfferBookCallbackV2 = procedure(
rAssetID : TAssetIDRec ;
nAction : Integer;
nPosition : Integer;
Side : Integer;
nQtd : Int64;
nAgent : Integer;
nOfferID : Int64;
dPrice : Double;
bHasPrice : Char;
bHasQtd : Char;
bHasDate : Char;
bHasOfferID : Char;
bHasAgent : Char;
pwcDate : PWideChar;
pArraySell : Pointer
pArrayBuy : Pointer) stdcall;

TAccountCallback = procedure(
nCorretora : Integer;
CorretoraNomeCompleto : PWideChar;
AccountID : PWideChar
NomeTitular : PWideChar) stdcall; forward;

TOrderChangeCallback = procedure(
rAssetID : TAssetIDRec;
nCorretora : Integer;
nQtd : Integer;
nTradedQtd : Integer;
nLeavesQtd : Integer;
nSide : Integer;
dPrice : Double;
dStopPrice : Double;
dAvgPrice : Double;
nProfitID : Int64;
TipoOrdem : PWideChar;
Conta : PWideChar;
Titular : PWideChar;
ClOrdID : PWideChar;
Status : PWideChar;
Date : PWideChar;
TextMessage : PWideChar) stdcall;

THistoryCallback = procedure(
rAssetID : TAssetIDRec;
nCorretora : Integer;
nQtd : Integer;
nTradedQtd : Integer;
nLeavesQtd : Integer;
nSide : Integer;
dPrice : Double;
dStopPrice : Double;
dAvgPrice : Double;
nProfitID : Int64;
TipoOrdem : PWideChar;
Conta : PWideChar;
Titular : PWideChar;
ClOrdID : PWideChar;
Status : PWideChar;
Date : PWideChar) stdcall;

THistoryTradeCallback = procedure(
rAssetID : TAssetIDRec;
pwcDate : PWideChar;
nTradeNumber : Cardinal;
dPrice : Double;
dVol : Double;
nQtd : Integer;
nBuyAgent : Integer;
nSellAgent : Integer;
nTradeType : Integer) stdcall;

TTinyBookCallback = procedure(
rAssetID : TAssetIDRec;
dPrice : Double;
nQtd : Integer;
nSide : Integer) stdcall;

TAssetListCallback = procedure(
rAssetID : TAssetIDRec;
pwcName : PWideChar) stdcall;

TAssetListInfoCallback = procedure(
rAssetID : TAssetIDRec;
pwcName : PWideChar;
pwcDescription : PWideChar;
nMinOrderQtd : Integer;
nMaxOrderQtd : Integer;
nLote : Integer;
stSecurityType : Integer;
ssSecuritySubType : Integer;
dMinPriceIncrement : Double;
dContractMultiplier : Double;
strValidDate : PWideChar;
strISIN : PWideChar) stdcall;

TAssetListInfoCallbackV2 = procedure(
rAssetID : TAssetIDRec;
pwcName : PWideChar;
pwcDescription : PWideChar;
nMinOrderQtd : Integer;
nMaxOrderQtd : Integer;
nLote : Integer;
stSecurityType : Integer;
ssSecuritySubType : Integer;
dMinPriceIncrement : Double;
dContractMultiplier : Double;
strValidDate : PWideChar;
strISIN : PWideChar;
strSetor : PWideChar;
strSubSetor : PWideChar;
strSegmento : PWideChar) stdcall;

TChangeStateTicker = procedure(
rAssetID : TAssetIDRec;
pwcDate : PWideChar;
nState : Integer) stdcall;

TAdjustHistoryCallback = procedure(
rAssetID : TAssetIDRec;
dValue : Double;
strAdjustType : PWideChar;
strObserv : PWideChar;
dtAjuste : PWideChar;
dtDeliber : PWideChar;
dtPagamento : PWideChar;
nAffectPrice : Integer) stdcall;

TAdjustHistoryCallbackV2 = procedure(
rAssetID : TAssetIDRec;
dValue : Double;
strAdjustType : PwideChar;
strObserv : PwideChar;
dtAjuste : PwideChar;
dtDeliber : PwideChar;
dtPagamento : PwideChar;
nFlags : Cardinal;
dMult : Double) stdcall;

TTheoreticalPriceCallback = procedure(
rAssetID : TAssetIDRec;
dTheoreticalPrice : Double;
nTheoreticalQtd : Int64) stdcall;

TChangeCotation = procedure(
rAssetID : TAssetIDRec;
pwcDate : PWideChar;
nTradeNumber : Cardinal;
dPrice : Double) stdcall;

THistoryCallbackV2 = procedure(
rAssetID : TAssetIDRec;
nCorretora : Integer;
nQtd : Integer;
nTradedQtd : Integer;
nLeavesQtd : Integer;
nSide : Integer;
nValidity : Integer;
dPrice : Double;
dStopPrice : Double;
dAvgPrice : Double;
nProfitID : Int64;
TipoOrdem : PWideChar;
Conta : PWideChar;
Titular : PWideChar;
ClOrdID : PWideChar;
Status : PWideChar;
LastUpdate : PWideChar;
CloseDate : PWideChar;
ValidityDate : PWideChar) stdcall;

TOrderChangeCallbackV2 = procedure(
rAssetID : TAssetIDRec;
nCorretora : Integer;
nQtd : Integer;
nTradedQtd : Integer;
nLeavesQtd : Integer;
nSide : Integer;
nValidity : Integer;
dPrice : Double;
dStopPrice : Double;
dAvgPrice : Double;
nProfitID : Int64;
TipoOrdem : PWideChar;
Conta : PWideChar;
Titular : PWideChar;
ClOrdID : PWideChar;
Status : PWideChar;
LastUpdate : PWideChar;
CloseDate : PWideChar;
ValidityDate : PWideChar;
TextMessage : PWideChar) stdcall;

TStateCallback

Corresponds to the callback to inform the login state, connection status, routing status, and product
activation. According to the type of nConnStateType provided, which are:

CONNECTION_STATE_LOGIN = 0; // Connection to login server


CONNECTION_STATE_ROTEAMENTO = 1; // Connection to routing server
CONNECTION_STATE_MARKET_DATA = 2; // Connection to market data server
CONNECTION_STATE_MARKET_LOGIN = 3; // Login to server market data

LOGIN_CONNECTED = 0; // Login server connected


LOGIN_INVALID = 1; // Login is invalid
LOGIN_INVALID_PASS = 2; // Password is invalid
LOGIN_BLOCKED_PASS = 3; // Password is blocked
LOGIN_EXPIRED_PASS = 4; // Password has expired
LOGIN_UNKNOWN_ERR = 200; // Internal login error

ROTEAMENTO_DISCONNECTED = 0;
ROTEAMENTO_CONNECTING = 1;
ROTEAMENTO_CONNECTED = 2;
ROTEAMENTO_BROKER_DISCONNECTED = 3;
ROTEAMENTO_BROKER_CONNECTING = 4;
ROTEAMENTO_BROKER_CONNECTED = 5;

MARKET_DISCONNECTED = 0; // Disconnected from the market data server


MARKET_CONNECTING = 1; // Connecting to the market data server
MARKET_WAITING = 2; // Waiting for connection
MARKET_NOT_LOGGED = 3; // Not logged into the market data server
MARKET_CONNECTED = 4; // Connected to the market data

CONNECTION_ACTIVATE_VALID = 0; // Valid activation


CONNECTION_ACTIVATE_INVALID = 1; // Invalid activation

Given that the type nConnStateType received is one of the values of CONNECTION_STATE, and nResult is the
login state of the specific service. The correct values for a valid connection are:

nConnStateType = CONNECTION_STATE_LOGIN
nResult = LOGIN_CONNECTED
nConnStateType = CONNECTION_STATE_ROTEAMENTO
nResult = ROTEAMENTO_CONNECTED
nConnStateType = CONNECTION_STATE_MARKET_DATA
nResult = MARKET_CONNECTED
nConnStateType = CONNECTION_STATE_MARKET_LOGIN
nResult = CONNECTION_ACTIVATE_VALID

TNewTradeCallback

Name Type Description

rAssetID TAssetIDRec Asset to which the trade belongs

Trade date in the format DD/MM/YYYY HH:mm:SS.ZZZ (mm =


pwcDate PWideChar
minute, MM = month and ZZZ = millisecond)

nTradeNumber Cardinal Serial number of a trade

dPrice Double Execution price

dVol Double Financial volume

nQtd Integer Quantity

nBuyAgent Integer Buying agent

nSellAgent Integer Selling agent

nTradeType Integer Trade type

bEdit Char Indicates if it is an edit

Corresponds to the callback to inform a new trade, received after subscribing to this asset (according to the
previously specified SubscribeTicker function). The nTradeNumber is the unique identifier of the trade per
trading session. bEdit indicates whether the received trade is an edit (information from the exchange) or an
addition. The ID to identify an edited trade is pwcDate. tradeType indicates the type of trade according to
the table below:"

1. Cross trade
2. Agressive Buy
3. Agressive Sell
4. Auction
5. Surveillance
6. Expit
7. Options Exercise
8. Over the counter
9. Derivative Term
10. Index
11. BTC
12. On Behalf
13. RLP
32. Unknown

TNewDailyCallback

Name Type Description

rAssetID TAssetIDRec Asset to which the trade belongs

Trade date in the format DD/MM/YYYY HH:mm:SS.ZZZ (mm =


pwcDate PWideChar
minute, MM = month, and ZZZ = millisecond)

dOpen Double Trade price at market open

dHigh Double Highest price reached

dLow Double Lowest price reached

dClose Double Price of the last trade

dVol Double Financial volume

dAjuste Double Price adjustment

dMaxLimit Double Upper price limit for order

dMinLimit Double Lower price limit for order

dVolBuyer Double Volume of buyers

dVolSeller Double Volume of sellers

nQtd Integer Quantity

nNegocios Integer Total number of trades

nContratosOpen Integer Number of open contracts


Name Type Description

nQtdBuyer Integer Number of buyers

nQtdSeller Integer Number of sellers

nNegBuyer Integer Number of buyer trades

nNegSeller Integer Number of seller trades

Corresponds to the callback to provide a new quotation with aggregated information from the trading day.

TPriceBookCallback

Name Type Description

rAssetID TAssetIDRec Asset to which the market depth belongs

nAction Integer Action to be performed on the market depth

nPosition Integer Position where the offer is to be inserted

nSide Integer Buy or sell (Buy=0, Sell=1)

nQtds Integer Quantity sold/bought

nCount Integer Number of offers sold/bought

dPrice Double Offered price

pArraySell Pointer Complete sell market depth

pArrayBuy Pointer Complete buy market depth

Corresponds to the callback to provide an update in the price market depth. The parameters are valid or not
according to the value of nAction, described below in detail:

rAssetID: Ticker;
nAction: (atAdd = 0, atEdit = 1, atDelete = 2, atDeleteFrom = 3, atFullBook = 4);
nPosition: Position in the grid; (Valid in atAdd, atEdit, atDelete and atDeleteFrom).
Side: Buy or sell; (Always valid).
nQtds: Quantity sold/bought; (Valid in atAdd and atEdit).
nCount: Number of offers sold/bought; (Valid in atAdd and atEdit).
dPrice: Price; (Valid in atAdd).

pArraySell, pArrayBuy: List of buy/sell offers; (Valid in atFullBook)..

This callback was designed to maintain separate lists of buy and sell offers. Therefore, each nAction received
must be handled to modify these lists, depending on the side received in nSide, as described below. All
adjustments depending on nPosition refer to the position from the end of the list (in lists starting at 0, size -
nPosition - 1).

atAdd: Insert a new offer after the position given by nPosition.


atDelete: Delete an offer at the position given by nPosition.
atDeleteFrom: Remove all offers starting from the position given by nPosition.
atEdit: Update the offer information at the position given by nPosition.
atFullBook: Create the market depth with all existing offers.

These details are received through the pArrayBuy and pArraySell parameters. For creating the list, when
receiving atFullBook, both pArrayBuy and pArraySell arrays have the following layout in memory:

Header

Field Type Size Offset

Number of offers (Q) Integer 4 bytes 0

Array size (to be used in FreePointer) Integer 4 bytes 4

Q entries to be inserted into the market depth, containing

Field Type Size Offset

Price Double 8 bytes 8

Quantity Integer 4 bytes 16

Count Integer 4 bytes 20

For more details on how to correctly assemble the market depth, refer to the examples in C++ and Delphi.

TPriceBookCallbackV2

Name Type Description

rAssetID TAssetIDRec Asset to which the market depth belongs

nAction Integer Action to be performed on the market depth

nPosition Integer Position where the offer is to be inserted

nSide Integer Buy or sell (Buy=0, Sell=1)

nQtds Int64 Quantity sold/bought

nCount Integer Number of offers sold/bought

dPrice Double Offered price

pArraySell Pointer Complete sell market depth

pArrayBuy Pointer Complete buy market depth

Corresponds to the callback to provide an update in the price market depth. The parameters are valid or not
according to the value of nAction, described below in detail:

rAssetID: Ticker;
nAction: (atAdd = 0, atEdit = 1, atDelete = 2, atDeleteFrom = 3, atFullBook = 4);
nPosition: Position in the grid; (Valid in atAdd, atEdit, atDelete, and atDeleteFrom).
Side: Buy or sell; (Always valid).
nQtds: Quantity sold/bought; (Valid in atAdd and atEdit).
nCount: Number of offers sold/bought; (Valid in atAdd and atEdit).
dPrice: Price; (Valid in atAdd).

pArraySell, pArrayBuy: List of buy/sell offers; (Valid in atFullBook).

This callback was designed to maintain separate lists of buy and sell offers. Therefore, each nAction received
must be handled to modify these lists, depending on the side received in nSide, as described below. All
adjustments depending on nPosition refer to the position from the end of the list (in lists starting at 0, size -
nPosition - 1).

atAdd: Insert a new offer after the position given by nPosition.


atDelete: Delete an offer at the position given by nPosition.
atDeleteFrom: Remove all offers starting from the position given by nPosition.
atEdit: Update the offer information at the position given by nPosition.
atFullBook: Create the market depth with all existing offers.

These details are received through the pArrayBuy and pArraySell parameters. For creating the list, when
receiving atFullBook, both pArrayBuy and pArraySell arrays have the following layout in memory:

Header

Field Type Size Offset

Number of offers (Q) Integer 4 bytes 0

Array size (to be used in FreePointer) Integer 4 bytes 4

Q entries to be inserted into the market depth, containing

Field Type Size Offset

Price Double 8 bytes 8

Quantity Int64 8 bytes 16

Count Cardinal 4 bytes 24

For more details on how to correctly assemble the market depth, refer to the examples in C++ and Delphi.

TOfferBookCallback

Name Type Description

rAssetID TAssetIDRec Asset to which the market depth belongs

nAction Integer Action to be performed on the market depth

nPosition Integer Position where the offer is to be inserted

nSide Integer Buy or sell (Buy=0, Sell=1)

nQtd Integer Quantity sold/bought

nAgent Integer Agent identifier


Name Type Description

nOfferID Integer Offer identifier

dPrice Double Offered price

bHasPrice Char 1 byte to specify if price exists

bHasQtd Char 1 byte to specify if quantity exists

bHasDate Char 1 byte to specify if date exists

bHasOfferID Char 1 byte to specify if offer ID exists

bHasAgent Char 1 byte to specify if agent exists

Offer date in the format DD/MM/YYYY DD/MM/YYYY HH:mm:SS.ZZZ


pwcDate PWideChar
(mm = minute, MM = month e ZZZ = millisecond)

pArraySell Pointer Complete sell market depth

pArrayBuy Pointer Complete buy market depth

Corresponds to the callback to provide an update in the order book:

rAssetID: Ticker; nAction: (atAdd = 0, atEdit = 1, atDelete = 2, atDeleteFrom = 3, atFullBook = 4);


nPosition: Position in the array; nSide: Order side (Buy=0, Sell=1);
nQtd: Quantity sold/bought;
nAgent: Indicates the IDs of the buying and selling agents, respectively; It is possible to obtain their
names through the functions GetAgentNameByID and GetAgentShortNameByID already specified;

The callback is handled following the same specification as TPriceBookCallback, except for the layout of the
pArrayBuy and pArraySell arrays:

Header

Field Type Size Offset

Number of offers (Q) (Q) Integer 4 bytes 0

Array size (to be used in FreePointer) Integer 4 bytes 4

Q entries to be inserted into the market depth, containing

Field Type Size Offset

Price Double 8 bytes 8

Quantity Integer 4 bytes 16

Agent Integer 4 bytes 20

OfferID Int64 8 bytes 24

S string size for Date Short 2 bytes 32


Field Type Size Offset

Offer date Array of bytes T bytes 34

TOfferBookCallbackV2

Name Type Description

rAssetID TAssetIDRec Asset to which the market depth belongs

nAction Integer Action to be performed on the market depth

nPosition Integer Position where the offer is to be inserted

nSide Integer Buy or sell (Buy=0, Sell=1)

nQtd Int64 Quantity sold/bought

nAgent Integer Agent identifier

nOfferID Integer Offer identifier

dPrice Double Offered price

bHasPrice Char 1 byte to specify if price exists

bHasQtd Char 1 byte to specify if quantity exists

bHasDate Char 1 byte to specify if date exists

bHasOfferID Char 1 byte to specify if offer ID exists

bHasAgent Char 1 byte to specify if agent exists

Offer date in the format DD/MM/YYYY HH:mm:SS.ZZZ (mm =


pwcDate PWideChar
minute, MM = month, ZZZ = millisecond)

pArraySell Pointer Complete sell market depth

pArrayBuy Pointer Complete buy market depth

Corresponds to the callback to provide an update in the market depth:

rAssetID: Ticker; nAction: (atAdd = 0, atEdit = 1, atDelete = 2, atDeleteFrom = 3, atFullBook = 4);


nPosition: Position in the array; nSide: Order side (Buy=0, Sell=1);
nQtd: Quantity sold/bought;
nAgent: Indicates the IDs of the buying and selling agents, respectively; It is possible to obtain their
names through the functions GetAgentNameByID and GetAgentShortNameByID already specified;

The callback is handled following the same specification as TPriceBookCallbackV2, except for the layout of
the pArrayBuy and pArraySell arrays:

Header

Field Type Size Offset


Field Type Size Offset

Number of offers (Q) Integer 4 bytes 0

Array size (to be used in FreePointer) Integer 4 bytes 4

Q entries to be inserted into the market depth, containing

Field Type Size Offset

Price Double 8 bytes 8

Quantity Int64 8 bytes 16

Agent Integer 4 bytes 24

OfferID Int64 8 bytes 28

S string size for Date Short 2 bytes 36

Offer date Array of bytes T bytes 38

THistoryTradeCallback

Name Size Description

rAssetID TAssetIDRec Asset to which the trade belongs

Trade date in the format DD/MM/YYYY HH:mm:SS.ZZZ (mm =


pwcDate PWideChar
minute, MM = month e ZZZ = millisecond)

nTradeNumber Cardinal Serial number of a trade

dPrice Double Execution price

dVol Double Financial volume

nQtd Integer Quantity

nBuyAgent Integer Buying agent

nSellAgent Integer Selling agent

nTradeType Integer Trade type

Corresponds to the callback for trades that were requested via the GetHistoryTrades function.

TProgressCallback

Name Type Description

rAssetID TAssetIDRec Asset to which the history request refers

nProgress Integer Progress value (0-100 and 1000)


Corresponds to the progress callback of THistoryTradeCallback. When the progress equals 1000, it means
that all trades have been sent to the client application.

TTinyBookCallback

Name Type Description

rAssetID TAssetIDRec Asset to which the offer belongs

dPrice Double Offer price

nQtd Integer Quantity

nSide Integer Buy or sell side (Buy=0, Sell=1)

Corresponds to the top of the market depth callback. rAssetID indicates which asset the offer belongs to
according to the TAssetIDRec structure already specified. dPrice: Price; nQtd: Sell/Buy quantity; nSide: Order
side (Buy=0, Sell=1).

The callbacks described below are only available after initialization using the DLLInitializeLogin function,
therefore only for initialization with routing.

TAccountCallback

Name Type Description

nCorretora Integer Broker identifier

CorretoraNomeCompleto PWideChar Full name of the broker

AccountID PWideChar Client account identification

NomeTitular PWideChar Account holder's name

Corresponds to the callback to provide information on existing accounts. It is possible to verify if the account
is a simulation through the broker's name or identifier.

TOrderChangeCallback

Name Type Description

rAssetID TAssetIDRec Asset to which the market depth belongs

nCorretora Integer Broker identifier

nQtd Integer Order quantity

nTradedQtd Integer Quantity already executed

nLeavesQtd Integer Quantity pending execution

nSide Integer Order side (Buy=1, Sell=2)

dPrice Double Order price


Name Type Description

dStopPrice Double Stop price in case of a stop order

dAvgPrice Double Average execution price

nProfitID Int64 Internal session identifier for the order

TipoOrdem PWideChar Order type

Conta PWideChar Account identifier

Titular PWideChar Account holder

ClOrdID PWideChar Unique order identifier (permanent)

Status PWideChar Order status

Date PWideChar Order execution date

TextMessage PWideChar Extra information message

Corresponds to the callback to inform order modifications sent by an account.

THistoryCallback

Name Type Description

rAssetID TAssetIDRec Asset to which the market depth belongs

nCorretora Integer Broker identifier

nQtd Integer Order quantity

nTradedQtd Integer Quantity already executed

nLeavesQtd Integer Quantity pending execution

nSide Integer Order side (Buy=1, Sell=2)

dPrice Double Order price

dStopPrice Double Stop price in case of a stop order

dAvgPrice Double Average execution price

nProfitID Int64 Internal session identifier for the order

TipoOrdem PWideChar Order type

Conta PWideChar Account identifier

Titular PWideChar Account holder

ClOrdID PWideChar Unique order identifier (permanent)

Status PWideChar Order status

Date PWideChar Order execution date


Corresponds to the order history request callback. The history includes only orders from the current day.

TAssetListCallback

Name Type Description

rAssetID TAssetIDRec Asset to which the market depth belongs

pwcName PWideChar Asset description

Corresponds to the asset information request callback. It is necessary to use the SetAssetListCallback
function for this callback to receive data.

TAssetListInfoCallback

Name Type Description

rAssetID TAssetIDRec Asset to which the information belongs

pwcName PWideChar Asset name

pwcDescription PWideChar Asset description

nMinOrderQtd Integer Minimum allowed order quantity

nMaxOrderQtd Integer Maximum allowed order quantity

nLote Integer Lot size

stSecurityType Integer Asset Type *

ssSecuritySubType Integer Asset subtype **

dMinPriceIncrement Double Minimum price increment

dContractMultiplier Double Contract multiplier

strValidDate PWideChar Expiration date, if applicable

strISIN PWideChar Asset ISIN string

Corresponds to the asset information callback. The stSecurityType field represents the asset type returned,
which can be one of the following:

* Asset Type
0. stFuture
1. stSpot
2. stSpotOption
3. stFutureOption
4. stDerivativeTerm
5. stStock
6. stOption
7. stForward
8. stETF
9. stIndex
10. stOptionExercise
11. stUnknown
12. stEconomicIndicator
13. stMultilegInstrument
14. stCommonStock
15. stPreferredStock
16. stSecurityLoan
17. stOptionOnIndex
18. stRights
19. stCorporateFixedIncome
255. stNelogicaSyntheticAsset

The ssSecuritySubType field is a specification within the type and can be one of the following:

** Asset Subtype
0. ssFXSpot
1. ssGold
2. ssIndex
3. ssInterestRate
4. ssFXRate
5. ssForeignDebt
6. ssAgricultural
7. ssEnergy
8. ssEconomicIndicator
9. ssStrategy
10. ssFutureOption
11. ssVolatility
12. ssSwap
13. ssMiniContract
14. ssFinancialRollOver
15. ssAgriculturalRollOver
16. ssCarbonCredit
17. ssUnknown
18. ssFractionary
19. ssStock
20. ssCurrency
21. ssOTC // OTC Over-the-Counter Market
22. ssFII // FII Real Estate Investment Fund

// PUMA 2.0 -Equities


23. ssOrdinaryRights // DO
24. ssPreferredRights // DP
25. ssCommonShares // ON
26. ssPreferredShares // PN
27. ssClassApreferredShares // PNA
28. ssClassBpreferredShares // PNB
29. ssClassCpreferredShares // PNC
30. ssClassDpreferredShares // PND
31. ssOrdinaryReceipts // ON REC
32. ssPreferredReceipts // PN REC
33. ssCommonForward
34. ssFlexibleForward
35. ssDollarForward
36. ssIndexPointsForward
37. ssNonTradeableETFIndex
38. ssPredefinedCoveredSpread
39. ssTraceableETF
40. ssNonTradeableIndex
41. ssUserDefinedSpread
42. ssExchangeDefinedspread // Not currently used
43. ssSecurityLoan
44. ssTradeableIndex
45. ssOthers

46. ssBrazilianDepositaryReceipt // BDR


47. ssFund
48. ssOtherReceipt
49. ssOtherRight
50. ssUNIT
51. ssClassEPreferredShare // PNE
52. ssClassFPreferredShare // PNF
53. ssClassGPreferredShare // PNG
54. ssWarrant
55. ssNonTradableSecurityLending
56. ssForeignIndexETF
57. ssGovernmentETF
58. ssIpoOrFollowOn
59. ssGrossAuction
60. ssNetAuction
61. ssTradableIndexInPartnership
62. ssNontradableIndexInPartnership

63. ssFixedIncomeETF
64. ssNontradableFixedIncomeETF
65. ssOutrightPurchase
66. ssSpecificCollateralRepo
67. ssDebenture
68. ssRealStateReceivableCertificate
69. ssAgribusinessReceivableCertificate
70. ssPromissoryNote
71. ssLetraFinanceira
72. ssAmericanDepositaryReceipt
73. ssUnitInvestmentFund
74. ssReceivableInvestmentFund
75. ssOutrightTPlus1
76. ssRepoTPlus1
77. ssNonTradableGrossSettlement
78. ssNonTradableNetSettlement
79. ssETFPrimaryMarket
80. ssSharesPrimaryMarket
81. ssRightsPrimaryMarket
82. ssUnitPrimaryMarket
83. ssFundPrimaryMarket
84. ssForeignIndexETFPrimaryMarket
85. ssWarrantPrimaryMarket
86. ssReceiptPrimaryMarket
87. ssGermanPublicDebts
88. ssStockRollover

93. ssStrategySpotDollar
94. ssTargetRate
95. ssTradableETFRealState
96. ssNonTradableETFRealEstate
254. ssDefault

TAssetListInfoCallbackV2

Name Type Description

rAssetID TAssetIDRec Asset to which the information belongs

pwcName PWideChar Asset name

pwcDescription PWideChar Asset description

nMinOrderQtd Integer Minimum allowed order quantity

nMaxOrderQtd Integer Maximum allowed order quantity

nLote Integer Lot size

stSecurityType Integer Asset type *

ssSecuritySubType Integer Asset subtype **

dMinPriceIncrement Double Minimum price increment

dContractMultiplier Double Contract multiplier

strValidDate PWideChar Expiration date, if applicable

strISIN PWideChar Asset ISIN string

strSetor PWideChar activity sector

strSubSetor PWideChar Subsector within the sector

strSegmento PWideChar operating segment

Extension of the TAssetListInfoCallback callback, only adding the fields sector, subsector, and segment.

TTheoreticalPriceCallback

Name Type Description


Name Type Description

rAssetID TAssetIDRec Asset to which the information belongs

dTheoreticalPrice Double Theoretical price

nTheoreticalQtd Int64 Theoretical quantity

Corresponds to the callback for returning the theoretical price and quantities during an asset auction.

TAdjustHistoryCallback

Name Type Description

rAssetID TAssetIDRec Asset corresponding to the adjustment

dValue Double Adjustment value

strAdjustType PWideChar Adjustment type *

strObserv PWideChar Observation

dtAjuste PWideChar Adjustment date

dtDeliber PWideChar Deliberation date

dtPagamento PWideChar Payment date

nAffectPrice Integer Indicates whether it affects the price or not

Corresponds to the asset adjustment callback. To use this callback, it must be sent to the DLL through the
SetAdjustHistoryCallback function. It is preferable to use the SetAdjustHistoryCallbackV2 function,
which provides a more detailed description of how to calculate the adjustment.

* Adjustment Type
'None'
'Unknown'
'JurosRF'
'Dividendo'
'Rendimento'
'Subscricao'
'Desdobramento'
'ResgateTotalRF'
'ResgateTotalRV'
'AmortizacaoRF'
'JurosCapProprio'
'SubsComRenuncia'
'Bonificacao'
'Grupamento'
'JuncaoSerie'
'Cisao'
'Unknown'
TAdjustHistoryCallbackV2

Name Type Description

rAssetID TAssetIDRec Asset corresponding to the adjustment

dValue Double Adjustment value

strAdjustType PWideChar Adjustment type *

strObserv PWideChar Observation

dtAjuste PWideChar Adjustment date

dtDeliber PWideChar Deliberation date

dtPagamento PWideChar Payment date

nFlags Cardinal Sum flag (described below)

dMult Double Multiplier

Corresponds to the asset adjustment callback. To use this callback, it must be sent to the DLL through the
SetAdjustHistoryCallbackV2 function. nFlags is a bit field from b0 to b31, where bit 0 (least significant)
indicates whether the adjustment affects the price, and bit 1 indicates if it is a sum adjustment. dMult is the
pre-computed value that should be multiplied by the price to apply the adjustment. It is only used if the
adjustment is not a sum adjustment and affects the price, as indicated in the nFlags field. A dMult value of
-9999 indicates that it is invalid and should not be used. If dMult is invalid, dValue is used for the calculation,
where subtraction is performed for sum adjustments and division otherwise.

To calculate the adjustment, the parameters are used as follows:

When dMult is a valid value, the adjustment is made by multiplying the price by this value.
When the sum flag is set, the adjustment value is subtracted from the price
When the sum flag is not set, the price is divided by the adjustment value.

Pseudocode:

while Date < AdjustmentDate if nFlag AND 1 and


(type is different from Reverse Split, Merger, Split and not(Unknown and not(nFlag
AND 2))) or
(type is different from Reverse Split, Merger, Split and not(nFlag AND 2))
then
if dMult <> -9999
Result := Result * dMult
else
if (nFlag AND 2)
Price := Price - AdjustmentValue
else
Price := Price / AdjustmentValue

TChangeCotation
Name Type Description

rAssetID TAssetIDRec Asset in which the price change occurred

pwcDate PWideChar Date of the price change

nTradeNumber Cardinal Sequential number of the trade in which the change occurred

dPrice Double New price

This callback is used to report when a price modification occurs for the asset, providing the last price and time
of the trade. To use this callback, it must be sent to the DLL through the SetChangeCotationCallback
function.

TChangeStateTicker

Name Type Description

rAssetID TAssetIDRec Asset in which the state change occurred

pwcDate PWideChar Date of the state change

nState Integer Asset state

Corresponds to the callback for identifying an asset's state change. The provided date is when the state
modification occurred, but only some states show the date. The possible states are listed below:

0. tcsOpened // Asset in open trading


2. tcsFrozen
3. tcsInhibited
4. tcsAuctioned // Asset in auction
6. tcsClosed // Asset with closed trading
10. tcsPreClosing
13. tcsPreOpening

THistoryCallbackV2

Name Type Description

rAssetID TAssetIDRec Asset to which the market depth belongs

nCorretora Integer Broker identifier

nQtd Integer Order quantity

nTradedQtd Integer Quantity already executed

nLeavesQtd Integer Quantity pending execution

nSide Integer Order side (Buy=1, Sell=2)

nValidity Integer Order validity type*


Name Type Description

dPrice Double Order price

dStopPrice Double Stop price in case of stop order

dAvgPrice Double Average execution price

nProfitID Int64 Internal session identifier for the order

TipoOrdem PWideChar Order type

Conta PWideChar Account identifier

Titular PWideChar Account holder

ClOrdID PWideChar Unique order identifier (permanent)

Status PWideChar Order status

LastUpdate PWideChar Date of the last order update

CloseDate PWideChar Order close date, if already closed

ValidityDate PWideChar Reference date for order validity

Corresponds to the secondary (optional) callback for the order history request. To use this callback, it must be
sent to the DLL through the SetHistoryCallbackV2 function, and it will be called under the same conditions
as THistoryCallback. The history corresponds only to orders from the current day. The nValidity field
represents the order validity type, which can be one of the following values:

* Order validity type


0. btfDay
1. btfGoodTillCancel
2. btfAtTheOpening
3. btfImmediateOrCancel
4. btfFillOrKill
5. btfGoodTillCrossing
6. btfGoodTillDate
7. btfAtTheClose
201. btfGoodForAuction
200. btfUnknown

TOrderChangeCallbackV2

Name Type Description

rAssetID TAssetIDRec Asset to which the market depth belongs

nCorretora Integer Broker identifier

nQtd Integer Order quantity

nTradedQtd Integer Quantity already executed


Name Type Description

nLeavesQtd Integer Quantity pending execution

nSide Integer Order side (Buy=1, Sell=2)

nValidity Integer Order validity type

dPrice Double Order price

dStopPrice Double Stop price in case of stop order

dAvgPrice Double Average execution price

nProfitID Int64 Internal session identifier for the order

TipoOrdem PWideChar Order type

Conta PWideChar Account identifier

Titular PWideChar Account holder

ClOrdID PWideChar Unique order identifier (permanent)

Status PWideChar Order status

LastUpdate PWideChar Date of the last order update

CloseDate PWideChar Order close date, if already closed

ValidityDate PWideChar Reference date for order validity

TextMessage PWideChar Extra information message

Corresponds to the secondary (optional) callback for reporting order modifications sent by an account. To use
this callback, it must be sent to the DLL through the SetOrderChangeCallbackV2 function, and it will be
called under the same conditions as TOrderChangeCallback. The nValidity field represents the order
validity type, and the possible values can be checked in the THistoryCallbackV2 documentation.

4. Product Usage
Initializing with Routing

To use the library, it is essential to initialize the services through the initialization functions. More specifically, if
routing services are to be used, the DLLInitializeLogin function must be used, which will establish a
connection to the routing and market data servers.

This function is described in the exposed functions section and requires an activation code provided at the
time of product purchase, as well as a username and password to log into the authentication server. The other
parameters are mandatory callbacks that will be called by the DLL during use and need to be specified at the
time of initialization.

It is important to note that all callbacks occur in a thread called ConnectorThread and, therefore, happen
simultaneously with the client application. The client application should process the data provided through
the callbacks as data to be consumed from another thread. If necessary, the handling of writing this data
should be done with critical sections or mutexes.

The data received via callbacks is stored in a single data queue, so any lengthy processing within the callback
functions may delay the internal message processing queue of the DLL and cause delays in receiving trades or
other information. To avoid this, the data should be processed and passed to other application threads
immediately, or perform the minimum processing possible. Database accesses or disk writes should be
avoided during the processing of a callback.

Finally, it is important to note that callbacks are designed only to receive data. Therefore, request functions to
the DLL or any other function from the DLL interface should not be called within a callback, as this may cause
unexpected exceptions and undefined behavior.

More implementation details can be clarified in the provided examples.

Initializing with Market Data

The Market Data initialization process is analogous to the Routing initialization, with the difference being the
initialization function DLLInitializeMarketLogin and a reduction in the callbacks passed as parameters, as they
are related to routing orders or accounts.

Data Types

All types mentioned in this document are types specified in the Delphi language. Below are some links for
conversion or mapping of these types to the languages used in the examples.

Delphi to C Type Mapping

https://docwiki.embarcadero.com/RADStudio/Tokyo/en/Delphi_to_C%2B%2B_types_mapping

C Type to Python Conversion

https://docs.python.org/2/library/ctypes.html

Delphi to C# Type Conversion

http://www.netcoole.com/delphi2cs/datatype.htm

32-bit Linkage

To use the library in 32-bit mode, the application must also be compiled in 32 bits. Since it operates in 32 bits,
there is a 4GB memory limitation, which will be shared between the library and the client application.
Therefore, it is not recommended to request large amounts of data in a single request, as this could exceed
the process's memory limit.

C#

Using Visual Studio, it is necessary to change the target platform in the Configuration Manager
from Any CPU to x86.

Python
The python.exe interpreter must also be 32-bit. Additionally, there is a bug in 32-bit Python
where a callback containing a type larger than 32 bits fails and causes an exception. Follow the
issue here: https://bugs.python.org/issue41021. Therefore, we recommend that clients who wish
to use 32-bit Python use version 3.6.2, which was tested by the Nelogica team and does not have
this issue.

For other languages, it is only necessary to switch the compilation mode to 32 bits.

64-bit Linkage

To use the library in 64-bit mode, the application must also be compiled in 64 bits. The calling convention
remains stdcall, just like in the 32-bit version. There are no known issues with the example languages in the
64-bit version, so there is no recommended version; the latest versions of each language can be used.

The 64-bit version does not have a memory limitation and can therefore use the maximum available memory
in the system, allowing larger data requests in a single request, limited by the amount of available RAM.

You might also like