Добрый день!
Загружаю trans2quik.dll динамически
unit tr2quik;
interface
uses
WinApi.Windows, System.Sysutils;
const
DllName = 'TRANS2QUIK.DLL';
//-------------- Constants --------------------------
TRANS2QUIK_SUCCESS = 0;
TRANS2QUIK_FAILED = 1;
TRANS2QUIK_QUIK_TERMINAL_NOT_FOUND = 2;
TRANS2QUIK_DLL_VERSION_NOT_SUPPORTED = 3;
TRANS2QUIK_ALREADY_CONNECTED_TO_QUIK = 4;
TRANS2QUIK_WRONG_SYNTAX = 5;
TRANS2QUIK_QUIK_NOT_CONNECTED = 6;
TRANS2QUIK_DLL_NOT_CONNECTED = 7;
TRANS2QUIK_QUIK_CONNECTED = 8;
TRANS2QUIK_QUIK_DISCONNECTED = 9;
TRANS2QUIK_DLL_CONNECTED = 10;
TRANS2QUIK_DLL_DISCONNECTED = 11;
TRANS2QUIK_MEMORY_ALLOCATION_ERROR = 12;
TRANS2QUIK_WRONG_CONNECTION_HANDLE = 13;
TRANS2QUIK_WRONG_INPUT_PARAMS = 14;
ORDER_QUIKDATE = 0;
ORDER_QUIKTIME = 1;
ORDER_MICROSEC = 2;
ORDER_WITHDRAW_QUIKDATE = 3;
ORDER_WITHDRAW_QUIKTIME = 4;
ORDER_WITHDRAW_MICROSEC = 5;
TRADE_QUIKDATE = 0;
TRADE_QUIKTIME = 1;
TRADE_MICROSEC = 2;
//-------- Load library function -------
function LibLoad(const aPath: string): THandle;
//------------------------- Types ------------------------------
type
intptr_t = NativeInt;
Quantity = int64;
EntityNumber = uint64;
PEntityNumber = ^EntityNumber;
OrderDescr = intptr_t;
TradeDescr = intptr_t;
TransReplyDescr = intptr_t;
//----------------------- CallBack procedures ------------------
TRANS2QUIK_CONNECTION_STATUS_CALLBACK = procedure(nConnectionEvent: long;
var nExtendedErrorCode: long;
var lpcstrInfoMessage: LPCSTR); stdcall;
TRANS2QUIK_TRANSACTION_REPLY_CALLBACK = procedure(var nTransactionResult: long;
var nTransactionExtendedErrorCode: long;
var nTransactionReplyCode: long;
var dwTransId: DWord;
nOrderNum: EntityNumber;
var lpcstrTransactionReplyMessage: LPCSTR;
var transReplyDescriptor: TransReplyDescr); stdcall;
TRANS2QUIK_ORDER_STATUS_CALLBACK = procedure( nMode: long;
dwTransID: DWORD;
dNumber: EntityNumber;
ClassCode: LPCSTR;
SecCode: LPCSTR;
dPrice: double;
nBalance: Quantity;
dValue: double;
nIsSell: long;
nStatus: long;
orderDescriptor: OrderDescr); stdcall;
TRANS2QUIK_TRADE_STATUS_CALLBACK = procedure( nMode: long;
dNumber: EntityNumber;
dOrderNumber: EntityNumber;
ClassCode: LPCSTR;
SecCode: LPCSTR;
dPrice: double;
nQty: Quantity;
dValue: double;
nIsSell: long;
tradeDescriptor: TradeDescr); stdcall;
//------------ Functions -------------------
TRANS2QUIK_SEND_SYNC_TRANSACTION = function(lpstTransactionString: LPSTR;
var pnReplyCode: long;
pdwTransId: PDWORD;
var pnOrderNum:EntityNumber;
lpstrResultMessage: LPSTR;
dwResultMessageSize: DWORD;
var pnExtendedErrorCode: long;
lpstErrorMessage: LPSTR;
dwErrorMessageSize: DWORD): long; stdcall;
TRANS2QUIK_SEND_ASYNC_TRANSACTION = function(lpstTransactionString: LPSTR;
var pnExtendedErrorCode: long;
var lpstErrorMessage: LPSTR;
var dwErrorMessageSize: DWORD): long; stdcall;
TRANS2QUIK_CONNECT = function(lpstConnectionParamsString: LPSTR;
var pnExtendedErrorCode: long;
var lpstrErrorMessage: LPSTR;
var dwErrorMessageSize: DWORD): long; stdcall;
TRANS2QUIK_DISCONNECT = function(var pnExtendedErrorCode: long;
lpstrErrorMessage: LPSTR;
dwErrorMessageSize: DWORD): long; stdcall;
TRANS2QUIK_SET_CONNECTION_STATUS_CALLBACK = function(pfConnectionStatusCallback: TRANS2QUIK_CONNECTION_STATUS_CALLBACK;
var pnExtendedErrorCode: long;
lpstrErrorMessage: LPSTR;
dwErrorMessageSize: DWORD): long; stdcall;
TRANS2QUIK_SET_TRANSACTIONS_REPLY_CALLBACK = function(pfTransactionReplyCallback: TRANS2QUIK_TRANSACTION_REPLY_CALLBACK;
var pnExtendedErrorCode: long;
lpstrErrorMessage: LPSTR;
dwErrorMessageSize: DWORD): long; stdcall;
TRANS2QUIK_IS_QUIK_CONNECTED = function(var pnExtendedErrorCode: long;
lpstrErrorMessage: LPSTR;
dwErrorMessageSize: Dword): long; stdcall;
TRANS2QUIK_IS_DLL_CONNECTED = function(var pnExtendedErrorCode: long;
lpstrErrorMessage: LPSTR;
dwErrorMessageSize: DWORD): long; stdcall;
TRANS2QUIK_SUBSCRIBE_ORDERS = function(ClassCode: LPSTR;
Seccodes: LPSTR): long; stdcall;
TRANS2QUIK_UNSUBSCRIBE_ORDERS = function(): long; stdcall;
TRANS2QUIK_START_ORDERS = function(pfnOrderStatusCallback: TRANS2QUIK_ORDER_STATUS_CALLBACK): long; stdcall;
TRANS2QUIK_ORDER_QTY = function(orderDescriptor: OrderDescr): Quantity; stdcall;
TRANS2QUIK_ORDER_DATE = function(orderDescriptor: OrderDescr): long; stdcall;
TRANS2QUIK_ORDER_TIME = function(orderDescriptor: OrderDescr): long; stdcall;
TRANS2QUIK_ORDER_ACTIVATION_TIME = function(orderDescriptor: OrderDescr): long; stdcall;
TRANS2QUIK_ORDER_WITHDRAW_TIME = function(orderDescriptor: OrderDescr): long; stdcall;
TRANS2QUIK_ORDER_EXPIRY = function(orderDescriptor: OrderDescr): long; stdcall;
TRANS2QUIK_ORDER_ACCRUED_INT = function(orderDescriptor: OrderDescr): Double; stdcall;
TRANS2QUIK_ORDER_YIELD = function(orderDescriptor: OrderDescr): double; stdcall;
TRANS2QUIK_ORDER_UID = function(orderDescriptor: OrderDescr): long; stdcall;
TRANS2QUIK_ORDER_VISIBLE_QTY = function(orderDescriptor: OrderDescr): Quantity; stdcall;
TRANS2QUIK_ORDER_PERIOD = function(orderDescriptor: OrderDescr): long; stdcall;
TRANS2QUIK_ORDER_FILETIME = function(orderDescriptor: OrderDescr): FILETIME; stdcall;
TRANS2QUIK_ORDER_DATE_TIME = function(orderDescriptor: OrderDescr; nTimeType: long): long; stdcall;
TRANS2QUIK_ORDER_WITHDRAW_FILETIME = function(orderDescriptor: OrderDescr): FILETIME; stdcall;
TRANS2QUIK_ORDER_VALUE_ENTRY_TYPE = function(orderDescriptor: OrderDescr): long; stdcall;
TRANS2QUIK_ORDER_EXTENDED_FLAGS = function(orderDescriptor: OrderDescr): long; stdcall;
TRANS2QUIK_ORDER_MIN_QTY = function(orderDescriptor: OrderDescr): Quantity; stdcall;
TRANS2QUIK_ORDER_EXEC_TYPE = function(orderDescriptor: OrderDescr): long; stdcall;
TRANS2QUIK_ORDER_AWG_PRICE = function(orderDescriptor: OrderDescr): double; stdcall;
TRANS2QUIK_ORDER_USERID = function(orderDescriptor: OrderDescr): LPTSTR; stdcall;
TRANS2QUIK_ORDER_ACCOUNT = function(orderDescriptor: OrderDescr): LPTSTR; stdcall;
TRANS2QUIK_ORDER_BROKERREF = function(orderDescriptor: OrderDescr): LPTSTR; stdcall;
TRANS2QUIK_ORDER_CLIENT_CODE = function(orderDescriptor: OrderDescr): LPTSTR; stdcall;
TRANS2QUIK_ORDER_FIRMID = function(orderDescriptor: OrderDescr): LPTSTR; stdcall;
TRANS2QUIK_ORDER_REJECT_REASON = function(orderDescriptor: OrderDescr): LPTSTR; stdcall;
TRANS2QUIK_SUBSCRIBE_TRADES = function(ClassCode: LPSTR; Seccodes: LPSTR): long; stdcall;
TRANS2QUIK_UNSUBSCRIBE_TRADES = function(): long; stdcall;
TRANS2QUIK_START_TRADES = function(pfnTradeStatusCallback: TRANS2QUIK_TRADE_STATUS_CALLBACK): long; stdcall;
TRANS2QUIK_TRADE_DATE = function(tradeDescriptor: TradeDescr): long; stdcall;
TRANS2QUIK_TRADE_SETTLE_DATE = function(tradeDescriptor: TradeDescr): long; stdcall;
TRANS2QUIK_TRADE_TIME = function(tradeDescriptor: TradeDescr): long; stdcall;
TRANS2QUIK_TRADE_IS_MARGINAL = function(tradeDescriptor: TradeDescr): long; stdcall;
TRANS2QUIK_TRADE_ACCRUED_INT = function(tradeDescriptor: TradeDescr): double; stdcall;
TRANS2QUIK_TRADE_YIELD = function(tradeDescriptor: TradeDescr): double; stdcall;
TRANS2QUIK_TRADE_TS_COMMISSION = function(tradeDescriptor: TradeDescr): double; stdcall;
TRANS2QUIK_TRADE_CLEARING_CENTER_COMMISSION = function(tradeDescriptor: TradeDescr): double; stdcall;
TRANS2QUIK_TRADE_EXCHANGE_COMMISSION = function(tradeDescriptor: TradeDescr): double; stdcall;
TRANS2QUIK_TRADE_TRADING_SYSTEM_COMMISSION = function(tradeDescriptor: TradeDescr): double; stdcall;
TRANS2QUIK_TRADE_PRICE2 = function(tradeDescriptor: TradeDescr): double; stdcall;
TRANS2QUIK_TRADE_REPO_RATE = function(tradeDescriptor: TradeDescr): double; stdcall;
TRANS2QUIK_TRADE_REPO_VALUE = function(tradeDescriptor: TradeDescr): double; stdcall;
TRANS2QUIK_TRADE_REPO2_VALUE = function(tradeDescriptor: TradeDescr): double; stdcall;
TRANS2QUIK_TRADE_ACCRUED_INT2 = function(tradeDescriptor: TradeDescr): double; stdcall;
TRANS2QUIK_TRADE_REPO_TERM = function(tradeDescriptor: TradeDescr): long; stdcall;
TRANS2QUIK_TRADE_START_DISCOUNT = function(tradeDescriptor: TradeDescr): double; stdcall;
TRANS2QUIK_TRADE_LOWER_DISCOUNT = function(tradeDescriptor: TradeDescr): double; stdcall;
TRANS2QUIK_TRADE_UPPER_DISCOUNT = function(tradeDescriptor: TradeDescr): double; stdcall;
TRANS2QUIK_TRADE_BLOCK_SECURITIES = function(tradeDescriptor: TradeDescr): long; stdcall;
TRANS2QUIK_TRADE_PERIOD = function(tradeDescriptor: TradeDescr): long; stdcall;
TRANS2QUIK_TRADE_KIND = function(tradeDescriptor: TradeDescr): long; stdcall;
TRANS2QUIK_TRADE_FILETIME = function(tradeDescriptor: TradeDescr): FILETIME; stdcall;
TRANS2QUIK_TRADE_DATE_TIME = function(tradeDescriptor: TradeDescr; nTimeType: long): long; stdcall;
TRANS2QUIK_TRADE_BROKER_COMMISSION = function(tradeDescriptor: TradeDescr): double; stdcall;
TRANS2QUIK_TRADE_TRANSID = function(tradeDescriptor: TradeDescr): long; stdcall;
TRANS2QUIK_TRADE_CURRENCY = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
TRANS2QUIK_TRADE_SETTLE_CURRENCY = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
TRANS2QUIK_TRADE_SETTLE_CODE = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
TRANS2QUIK_TRADE_ACCOUNT = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
TRANS2QUIK_TRADE_BROKERREF = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
TRANS2QUIK_TRADE_CLIENT_CODE = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
TRANS2QUIK_TRADE_USERID = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
TRANS2QUIK_TRADE_FIRMID = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
TRANS2QUIK_TRADE_PARTNER_FIRMID = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
TRANS2QUIK_TRADE_EXCHANGE_CODE = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
TRANS2QUIK_TRADE_STATION_ID = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
TRANS2QUIK_TRANSACTION_REPLY_CLASS_CODE = function(tradeDescriptor: TransReplyDescr): LPTSTR; stdcall;
TRANS2QUIK_TRANSACTION_REPLY_SEC_CODE = function(tradeDescriptor: TransReplyDescr): LPTSTR; stdcall;
TRANS2QUIK_TRANSACTION_REPLY_PRICE = function(tradeDescriptor: TransReplyDescr): double; stdcall;
TRANS2QUIK_TRANSACTION_REPLY_QUANTITY = function(tradeDescriptor: TransReplyDescr): Quantity; stdcall;
TRANS2QUIK_TRANSACTION_REPLY_BALANCE = function(tradeDescriptor: TransReplyDescr): Quantity; stdcall;
TRANS2QUIK_TRANSACTION_REPLY_FIRMID = function(tradeDescriptor: TransReplyDescr): LPTSTR; stdcall;
TRANS2QUIK_TRANSACTION_REPLY_ACCOUNT = function(tradeDescriptor: TransReplyDescr): LPTSTR; stdcall;
TRANS2QUIK_TRANSACTION_REPLY_CLIENT_CODE = function(tradeDescriptor: TransReplyDescr): LPTSTR; stdcall;
TRANS2QUIK_TRANSACTION_REPLY_BROKERREF = function(tradeDescriptor: TransReplyDescr): LPTSTR; stdcall;
TRANS2QUIK_TRANSACTION_REPLY_EXCHANGE_CODE = function(tradeDescriptor: TransReplyDescr): LPTSTR; stdcall;
var
T2QConnStatCallBack: TRANS2QUIK_CONNECTION_STATUS_CALLBACK;
T2QTransReplyCallBack: TRANS2QUIK_TRANSACTION_REPLY_CALLBACK;
T2QOrderStatCallBack: TRANS2QUIK_ORDER_STATUS_CALLBACK;
T2QTradeStatCallBack: TRANS2QUIK_TRADE_STATUS_CALLBACK;
T2QSendSyncTrans: TRANS2QUIK_SEND_SYNC_TRANSACTION;
T2QSendASyncTrans: TRANS2QUIK_SEND_ASYNC_TRANSACTION;
T2QConnect: TRANS2QUIK_CONNECT;
T2QDisconnect: TRANS2QUIK_DISCONNECT;
T2QSetConnStatCallBAck: TRANS2QUIK_SET_CONNECTION_STATUS_CALLBACK;
T2QSetTransReplyCallBAck: TRANS2QUIK_SET_TRANSACTIONS_REPLY_CALLBACK;
T2QIsQuikConnected: TRANS2QUIK_IS_QUIK_CONNECTED;
T2QIsDllConnected: TRANS2QUIK_IS_DLL_CONNECTED;
T2QSubscribeOrders: TRANS2QUIK_SUBSCRIBE_ORDERS;
T2QUnSubscribeOrders: TRANS2QUIK_UNSUBSCRIBE_ORDERS;
T2QStartOrders: TRANS2QUIK_START_ORDERS;
T2QOrderQty: TRANS2QUIK_ORDER_QTY;
T2QOrderDate: TRANS2QUIK_ORDER_DATE;
T2QOrderTime: TRANS2QUIK_ORDER_TIME;
T2QOrderActiveTime: TRANS2QUIK_ORDER_ACTIVATION_TIME;
T2QOrderWithdrawTime: TRANS2QUIK_ORDER_WITHDRAW_TIME;
T2QOrderExpiry: TRANS2QUIK_ORDER_EXPIRY;
T2QOrderAccruedInt: TRANS2QUIK_ORDER_ACCRUED_INT;
T2QOrderYield: TRANS2QUIK_ORDER_YIELD;
T2QOrderUid: TRANS2QUIK_ORDER_UID;
T2QOrderVisibleQty: TRANS2QUIK_ORDER_VISIBLE_QTY;
T2QOrderPeriod: TRANS2QUIK_ORDER_PERIOD;
T2QOrderFileTime: TRANS2QUIK_ORDER_FILETIME;
T2QOrderDateTime: TRANS2QUIK_ORDER_DATE_TIME;
T2QOrderWithdrawFileTime: TRANS2QUIK_ORDER_WITHDRAW_FILETIME;
T2QOrderValueEntryType: TRANS2QUIK_ORDER_VALUE_ENTRY_TYPE;
T2QOrderExtdFlags: TRANS2QUIK_ORDER_EXTENDED_FLAGS;
T2QOrderMinQty: TRANS2QUIK_ORDER_MIN_QTY;
T2QOrderExecType: TRANS2QUIK_ORDER_EXEC_TYPE;
T2QOrderAwgPrice: TRANS2QUIK_ORDER_AWG_PRICE;
T2QOrderUserId: TRANS2QUIK_ORDER_USERID;
T2QOrderAccaunt: TRANS2QUIK_ORDER_ACCOUNT;
T2QOrderBrokerRef: TRANS2QUIK_ORDER_BROKERREF;
T2QOrderClientCode: TRANS2QUIK_ORDER_CLIENT_CODE;
T2QOrderFirmId: TRANS2QUIK_ORDER_FIRMID;
T2QOrderRejectReason: TRANS2QUIK_ORDER_REJECT_REASON;
T2QSubscribeTrades: TRANS2QUIK_SUBSCRIBE_TRADES;
T2QUnSubscribeTrades: TRANS2QUIK_UNSUBSCRIBE_TRADES;
T2QStartTrades: TRANS2QUIK_START_TRADES;
T2QTradeDate: TRANS2QUIK_TRADE_DATE;
T2QTradeSettleDate: TRANS2QUIK_TRADE_SETTLE_DATE;
T2QTradeTime: TRANS2QUIK_TRADE_TIME;
T2QTradeIsMarginal: TRANS2QUIK_TRADE_IS_MARGINAL;
T2QTradeAccruedInt: TRANS2QUIK_TRADE_ACCRUED_INT;
T2QTradeYield: TRANS2QUIK_TRADE_YIELD;
T2QTradeTSCommission: TRANS2QUIK_TRADE_TS_COMMISSION;
T2QTradeClCenterCommission: TRANS2QUIK_TRADE_CLEARING_CENTER_COMMISSION;
T2QTradeExcCommission: TRANS2QUIK_TRADE_EXCHANGE_COMMISSION;
T2QTradeTrSysCommission: TRANS2QUIK_TRADE_TRADING_SYSTEM_COMMISSION;
T2QTradePrice2: TRANS2QUIK_TRADE_PRICE2;
T2QTradeRepoRate: TRANS2QUIK_TRADE_REPO_RATE;
T2QTradeRepoValue: TRANS2QUIK_TRADE_REPO_VALUE;
T2QTradeRepo2Value: TRANS2QUIK_TRADE_REPO2_VALUE;
T2QTradeAccruedInt2: TRANS2QUIK_TRADE_ACCRUED_INT2;
T2QTradeRepoTerm: TRANS2QUIK_TRADE_REPO_TERM;
T2QTradeStDiscount: TRANS2QUIK_TRADE_START_DISCOUNT;
T2QTradeLwDiscount: TRANS2QUIK_TRADE_LOWER_DISCOUNT;
T2QTradeUpDiscount: TRANS2QUIK_TRADE_UPPER_DISCOUNT;
T2QTradeBlSecur: TRANS2QUIK_TRADE_BLOCK_SECURITIES;
T2QTradePeriod: TRANS2QUIK_TRADE_PERIOD;
T2QTradeKind: TRANS2QUIK_TRADE_KIND;
T2QTradeFileName: TRANS2QUIK_TRADE_FILETIME;
T2QTradeDateTime: TRANS2QUIK_TRADE_DATE_TIME;
T2QTradeBrCommission: TRANS2QUIK_TRADE_BROKER_COMMISSION;
T2QTradeTransId: TRANS2QUIK_TRADE_TRANSID;
T2QTradeCurrensy: TRANS2QUIK_TRADE_CURRENCY;
T2QTradeSettlCurr: TRANS2QUIK_TRADE_SETTLE_CURRENCY;
T2QTradeSettlCode: TRANS2QUIK_TRADE_SETTLE_CODE;
T2QTradeAccount: TRANS2QUIK_TRADE_ACCOUNT;
T2QTradeBrRef: TRANS2QUIK_TRADE_BROKERREF;
T2QTradeClCode: TRANS2QUIK_TRADE_CLIENT_CODE;
T2QTradeUserId: TRANS2QUIK_TRADE_USERID;
T2QTradeFirmId: TRANS2QUIK_TRADE_FIRMID;
T2QTradePartFirmId: TRANS2QUIK_TRADE_PARTNER_FIRMID;
T2QTradeExcCode: TRANS2QUIK_TRADE_EXCHANGE_CODE;
T2QTradeStationId: TRANS2QUIK_TRADE_STATION_ID;
T2QTransReplyClassCode: TRANS2QUIK_TRANSACTION_REPLY_CLASS_CODE;
T2QTransReplySecCode: TRANS2QUIK_TRANSACTION_REPLY_SEC_CODE;
T2QTransReplyPrice: TRANS2QUIK_TRANSACTION_REPLY_PRICE;
T2QTransReplyQty: TRANS2QUIK_TRANSACTION_REPLY_QUANTITY;
T2QTransReplyBal: TRANS2QUIK_TRANSACTION_REPLY_BALANCE;
T2QTransReplyFirmId: TRANS2QUIK_TRANSACTION_REPLY_FIRMID;
T2QTransReplyAccount: TRANS2QUIK_TRANSACTION_REPLY_ACCOUNT;
T2QTransReplyClCode: TRANS2QUIK_TRANSACTION_REPLY_CLIENT_CODE;
T2QTransReplyBrRef: TRANS2QUIK_TRANSACTION_REPLY_BROKERREF;
T2QTransReplyExcCode: TRANS2QUIK_TRANSACTION_REPLY_EXCHANGE_CODE;
implementation
function LibLoad(const aPath: string): THandle;
begin
Result:= LoadLibrary(PWideChar(IncludeTrailingPathDelimiter(aPath) + DllName));
@T2QSendSyncTrans := GetProcAddress(Result, PWideChar('TRANS2QUIK_SEND_SYNC_TRANSACTION'));
if(addr(T2QSendSyncTrans) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QSendASyncTrans := GetProcAddress(Result, PWideChar('TRANS2QUIK_SEND_ASYNC_TRANSACTION'));
if(addr(T2QSendASyncTrans) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QConnect:= GetProcAddress(Result, PWideChar('TRANS2QUIK_CONNECT'));
if(addr(T2QConnect) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QDisconnect := GetProcAddress(Result, PWideChar('TRANS2QUIK_DISCONNECT'));
if(addr(T2QDisconnect) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QSetConnStatCallBAck := GetProcAddress(Result, PWideChar('TRANS2QUIK_SET_CONNECTION_STATUS_CALLBACK'));
if(addr(T2QSetConnStatCallBAck) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QSetTransReplyCallBAck := GetProcAddress(Result, PWideChar('TRANS2QUIK_SET_TRANSACTIONS_REPLY_CALLBACK'));
if(addr(T2QSetTransReplyCallBAck) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QIsQuikConnected := GetProcAddress(Result, PWideChar('TRANS2QUIK_IS_QUIK_CONNECTED'));
if(addr(T2QIsQuikConnected) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QIsDllConnected := GetProcAddress(Result, PWideChar('TRANS2QUIK_IS_DLL_CONNECTED'));
if(addr(T2QIsDllConnected) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QSubscribeOrders := GetProcAddress(Result, PWideChar('TRANS2QUIK_SUBSCRIBE_ORDERS'));
if(addr(T2QSubscribeOrders) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QUnSubscribeOrders := GetProcAddress(Result, PWideChar('TRANS2QUIK_UNSUBSCRIBE_ORDERS'));
if(addr(T2QUnSubscribeOrders) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QStartOrders := GetProcAddress(Result, PWideChar('TRANS2QUIK_START_ORDERS'));
if(addr(T2QStartOrders) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderQty := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_QTY'));
if(addr(T2QOrderQty) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderDate := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_DATE'));
if(addr(T2QOrderDate) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_TIME'));
if(addr(T2QOrderTime) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderActiveTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_ACTIVATION_TIME'));
if(addr(T2QOrderActiveTime) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderWithdrawTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_WITHDRAW_TIME'));
if(addr(T2QOrderWithdrawTime) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderExpiry := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_EXPIRY'));
if(addr(T2QOrderExpiry) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderAccruedInt := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_ACCRUED_INT'));
if(addr(T2QOrderAccruedInt) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderYield := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_YIELD'));
if(addr(T2QOrderYield) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderUid := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_UID'));
if(addr(T2QOrderUid) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderVisibleQty := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_VISIBLE_QTY'));
if(addr(T2QOrderVisibleQty) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderPeriod := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_PERIOD'));
if(addr(T2QOrderPeriod) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderFileTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_FILETIME'));
if(addr(T2QOrderFileTime) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderDateTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_DATE_TIME'));
if(addr(T2QOrderDateTime) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderWithdrawFileTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_WITHDRAW_FILETIME'));
if(addr(T2QOrderWithdrawFileTime) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderValueEntryType := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_VALUE_ENTRY_TYPE'));
if(addr(T2QOrderValueEntryType) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderExtdFlags := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_EXTENDED_FLAGS'));
if(addr(T2QOrderExtdFlags) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderMinQty := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_MIN_QTY'));
if(addr(T2QOrderMinQty) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderExecType := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_EXEC_TYPE'));
if(addr(T2QOrderExecType) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderAwgPrice := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_AWG_PRICE'));
if(addr(T2QOrderAwgPrice) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderUserId := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_USERID'));
if(addr(T2QOrderUserId) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderAccaunt := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_ACCOUNT'));
if(addr(T2QOrderAccaunt) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderBrokerRef := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_BROKERREF'));
if(addr(T2QOrderBrokerRef) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderClientCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_CLIENT_CODE'));
if(addr(T2QOrderClientCode) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderFirmId := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_FIRMID'));
if(addr(T2QOrderFirmId) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderRejectReason := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_REJECT_REASON'));
if(addr(T2QOrderRejectReason) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QSubscribeTrades := GetProcAddress(Result, PWideChar('TRANS2QUIK_SUBSCRIBE_TRADES'));
if(addr(T2QSubscribeTrades) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QUnSubscribeTrades := GetProcAddress(Result, PWideChar('TRANS2QUIK_UNSUBSCRIBE_TRADES'));
if(addr(T2QUnSubscribeTrades) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QStartTrades := GetProcAddress(Result, PWideChar('TRANS2QUIK_START_TRADES'));
if(addr(T2QStartTrades) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeDate := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_DATE'));
if(addr(T2QTradeDate) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeSettleDate := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_SETTLE_DATE'));
if(addr(T2QTradeSettleDate) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_TIME'));
if(addr(T2QTradeTime) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeIsMarginal := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_IS_MARGINAL'));
if(addr(T2QTradeIsMarginal) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeAccruedInt := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_ACCRUED_INT'));
if(addr(T2QTradeAccruedInt) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeYield := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_YIELD'));
if(addr(T2QTradeYield) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeTSCommission := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_TS_COMMISSION'));
if(addr(T2QTradeTSCommission) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeClCenterCommission := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_TS_COMMISSION'));
if(addr(T2QTradeClCenterCommission) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeExcCommission := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_EXCHANGE_COMMISSION'));
if(addr(T2QTradeExcCommission) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeTrSysCommission := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_TRADING_SYSTEM_COMMISSION'));
if(addr(T2QTradeTrSysCommission) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradePrice2 := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_PRICE2'));
if(addr(T2QTradePrice2) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeRepoRate := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_REPO_RATE'));
if(addr(T2QTradeRepoRate) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeRepoValue := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_REPO_VALUE'));
if(addr(T2QTradeRepoValue) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeRepo2Value := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_REPO2_VALUE'));
if(addr(T2QTradeRepo2Value) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeAccruedInt2 := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_ACCRUED_INT2'));
if(addr(T2QTradeAccruedInt2) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeRepoTerm := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_REPO_TERM'));
if(addr(T2QTradeRepoTerm) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeStDiscount := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_START_DISCOUNT'));
if(addr(T2QTradeStDiscount) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeLwDiscount := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_LOWER_DISCOUNT'));
if(addr(T2QTradeLwDiscount) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeUpDiscount := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_UPPER_DISCOUNT'));
if(addr(T2QTradeUpDiscount) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeBlSecur := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_UPPER_DISCOUNT'));
if(addr(T2QTradeBlSecur) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradePeriod := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_PERIOD'));
if(addr(T2QTradePeriod) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeKind := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_KIND'));
if(addr(T2QTradeKind) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeFileName := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_FILETIME'));
if(addr(T2QTradeFileName) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeDateTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_DATE_TIME'));
if(addr(T2QTradeDateTime) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeBrCommission := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_BROKER_COMMISSION'));
if(addr(T2QTradeBrCommission) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeTransId := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_TRANSID'));
if(addr(T2QTradeTransId) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeCurrensy := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_CURRENCY'));
if(addr(T2QTradeCurrensy) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeSettlCurr := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_SETTLE_CURRENCY'));
if(addr(T2QTradeSettlCurr) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeSettlCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_SETTLE_CODE'));
if(addr(T2QTradeSettlCode) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeAccount := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_ACCOUNT'));
if(addr(T2QTradeAccount) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeBrRef := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_BROKERREF'));
if(addr(T2QTradeBrRef) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeClCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_CLIENT_CODE'));
if(addr(T2QTradeClCode) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeUserId := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_USERID'));
if(addr(T2QTradeUserId) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeFirmId := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_FIRMID'));
if(addr(T2QTradeFirmId) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradePartFirmId := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_PARTNER_FIRMID'));
if(addr(T2QTradePartFirmId) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeExcCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_EXCHANGE_CODE'));
if(addr(T2QTradeExcCode) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeStationId := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_STATION_ID'));
if(addr(T2QTradeStationId) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTransReplyClassCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_CLASS_CODE'));
if(addr(T2QTransReplyClassCode) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTransReplySecCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_SEC_CODE'));
if(addr(T2QTransReplySecCode) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTransReplyPrice := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_PRICE'));
if(addr(T2QTransReplyPrice) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTransReplyQty := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_QUANTITY'));
if(addr(T2QTransReplyQty) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTransReplyBal := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_BALANCE'));
if(addr(T2QTransReplyBal) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTransReplyFirmId := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_FIRMID'));
if(addr(T2QTransReplyFirmId) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTransReplyAccount := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_ACCOUNT'));
if(addr(T2QTransReplyAccount) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTransReplyClCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_CLIENT_CODE'));
if(addr(T2QTransReplyClCode) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTransReplyBrRef := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_BROKERREF'));
if(addr(T2QTransReplyBrRef) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTransReplyExcCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_EXCHANGE_CODE'));
if(addr(T2QTransReplyExcCode) = nil) then
begin
Result:= 0;
Exit;
end;
end;
end.
Всё нормально, хендл получен адреса функций тоже ОК,
но, при вызове функции
//--- load trsns2quik.dll ----
if (QuikPath <> '') then
FDllHandle:= LibLoad(QuikPath);
if(DllHandle > 0) then
begin
if(addr(T2QConnect) <> nil) then
res:= T2QConnect(PAnsiChar(RawByteString(QuikPath + '\info.exe')), ErrCode, ErrStr, ErrSize);
end;
Получаю ACCESS VIOLATION
Почему?
Загружаю trans2quik.dll динамически
unit tr2quik;
interface
uses
WinApi.Windows, System.Sysutils;
const
DllName = 'TRANS2QUIK.DLL';
//-------------- Constants --------------------------
TRANS2QUIK_SUCCESS = 0;
TRANS2QUIK_FAILED = 1;
TRANS2QUIK_QUIK_TERMINAL_NOT_FOUND = 2;
TRANS2QUIK_DLL_VERSION_NOT_SUPPORTED = 3;
TRANS2QUIK_ALREADY_CONNECTED_TO_QUIK = 4;
TRANS2QUIK_WRONG_SYNTAX = 5;
TRANS2QUIK_QUIK_NOT_CONNECTED = 6;
TRANS2QUIK_DLL_NOT_CONNECTED = 7;
TRANS2QUIK_QUIK_CONNECTED = 8;
TRANS2QUIK_QUIK_DISCONNECTED = 9;
TRANS2QUIK_DLL_CONNECTED = 10;
TRANS2QUIK_DLL_DISCONNECTED = 11;
TRANS2QUIK_MEMORY_ALLOCATION_ERROR = 12;
TRANS2QUIK_WRONG_CONNECTION_HANDLE = 13;
TRANS2QUIK_WRONG_INPUT_PARAMS = 14;
ORDER_QUIKDATE = 0;
ORDER_QUIKTIME = 1;
ORDER_MICROSEC = 2;
ORDER_WITHDRAW_QUIKDATE = 3;
ORDER_WITHDRAW_QUIKTIME = 4;
ORDER_WITHDRAW_MICROSEC = 5;
TRADE_QUIKDATE = 0;
TRADE_QUIKTIME = 1;
TRADE_MICROSEC = 2;
//-------- Load library function -------
function LibLoad(const aPath: string): THandle;
//------------------------- Types ------------------------------
type
intptr_t = NativeInt;
Quantity = int64;
EntityNumber = uint64;
PEntityNumber = ^EntityNumber;
OrderDescr = intptr_t;
TradeDescr = intptr_t;
TransReplyDescr = intptr_t;
//----------------------- CallBack procedures ------------------
TRANS2QUIK_CONNECTION_STATUS_CALLBACK = procedure(nConnectionEvent: long;
var nExtendedErrorCode: long;
var lpcstrInfoMessage: LPCSTR); stdcall;
TRANS2QUIK_TRANSACTION_REPLY_CALLBACK = procedure(var nTransactionResult: long;
var nTransactionExtendedErrorCode: long;
var nTransactionReplyCode: long;
var dwTransId: DWord;
nOrderNum: EntityNumber;
var lpcstrTransactionReplyMessage: LPCSTR;
var transReplyDescriptor: TransReplyDescr); stdcall;
TRANS2QUIK_ORDER_STATUS_CALLBACK = procedure( nMode: long;
dwTransID: DWORD;
dNumber: EntityNumber;
ClassCode: LPCSTR;
SecCode: LPCSTR;
dPrice: double;
nBalance: Quantity;
dValue: double;
nIsSell: long;
nStatus: long;
orderDescriptor: OrderDescr); stdcall;
TRANS2QUIK_TRADE_STATUS_CALLBACK = procedure( nMode: long;
dNumber: EntityNumber;
dOrderNumber: EntityNumber;
ClassCode: LPCSTR;
SecCode: LPCSTR;
dPrice: double;
nQty: Quantity;
dValue: double;
nIsSell: long;
tradeDescriptor: TradeDescr); stdcall;
//------------ Functions -------------------
TRANS2QUIK_SEND_SYNC_TRANSACTION = function(lpstTransactionString: LPSTR;
var pnReplyCode: long;
pdwTransId: PDWORD;
var pnOrderNum:EntityNumber;
lpstrResultMessage: LPSTR;
dwResultMessageSize: DWORD;
var pnExtendedErrorCode: long;
lpstErrorMessage: LPSTR;
dwErrorMessageSize: DWORD): long; stdcall;
TRANS2QUIK_SEND_ASYNC_TRANSACTION = function(lpstTransactionString: LPSTR;
var pnExtendedErrorCode: long;
var lpstErrorMessage: LPSTR;
var dwErrorMessageSize: DWORD): long; stdcall;
TRANS2QUIK_CONNECT = function(lpstConnectionParamsString: LPSTR;
var pnExtendedErrorCode: long;
var lpstrErrorMessage: LPSTR;
var dwErrorMessageSize: DWORD): long; stdcall;
TRANS2QUIK_DISCONNECT = function(var pnExtendedErrorCode: long;
lpstrErrorMessage: LPSTR;
dwErrorMessageSize: DWORD): long; stdcall;
TRANS2QUIK_SET_CONNECTION_STATUS_CALLBACK = function(pfConnectionStatusCallback: TRANS2QUIK_CONNECTION_STATUS_CALLBACK;
var pnExtendedErrorCode: long;
lpstrErrorMessage: LPSTR;
dwErrorMessageSize: DWORD): long; stdcall;
TRANS2QUIK_SET_TRANSACTIONS_REPLY_CALLBACK = function(pfTransactionReplyCallback: TRANS2QUIK_TRANSACTION_REPLY_CALLBACK;
var pnExtendedErrorCode: long;
lpstrErrorMessage: LPSTR;
dwErrorMessageSize: DWORD): long; stdcall;
TRANS2QUIK_IS_QUIK_CONNECTED = function(var pnExtendedErrorCode: long;
lpstrErrorMessage: LPSTR;
dwErrorMessageSize: Dword): long; stdcall;
TRANS2QUIK_IS_DLL_CONNECTED = function(var pnExtendedErrorCode: long;
lpstrErrorMessage: LPSTR;
dwErrorMessageSize: DWORD): long; stdcall;
TRANS2QUIK_SUBSCRIBE_ORDERS = function(ClassCode: LPSTR;
Seccodes: LPSTR): long; stdcall;
TRANS2QUIK_UNSUBSCRIBE_ORDERS = function(): long; stdcall;
TRANS2QUIK_START_ORDERS = function(pfnOrderStatusCallback: TRANS2QUIK_ORDER_STATUS_CALLBACK): long; stdcall;
TRANS2QUIK_ORDER_QTY = function(orderDescriptor: OrderDescr): Quantity; stdcall;
TRANS2QUIK_ORDER_DATE = function(orderDescriptor: OrderDescr): long; stdcall;
TRANS2QUIK_ORDER_TIME = function(orderDescriptor: OrderDescr): long; stdcall;
TRANS2QUIK_ORDER_ACTIVATION_TIME = function(orderDescriptor: OrderDescr): long; stdcall;
TRANS2QUIK_ORDER_WITHDRAW_TIME = function(orderDescriptor: OrderDescr): long; stdcall;
TRANS2QUIK_ORDER_EXPIRY = function(orderDescriptor: OrderDescr): long; stdcall;
TRANS2QUIK_ORDER_ACCRUED_INT = function(orderDescriptor: OrderDescr): Double; stdcall;
TRANS2QUIK_ORDER_YIELD = function(orderDescriptor: OrderDescr): double; stdcall;
TRANS2QUIK_ORDER_UID = function(orderDescriptor: OrderDescr): long; stdcall;
TRANS2QUIK_ORDER_VISIBLE_QTY = function(orderDescriptor: OrderDescr): Quantity; stdcall;
TRANS2QUIK_ORDER_PERIOD = function(orderDescriptor: OrderDescr): long; stdcall;
TRANS2QUIK_ORDER_FILETIME = function(orderDescriptor: OrderDescr): FILETIME; stdcall;
TRANS2QUIK_ORDER_DATE_TIME = function(orderDescriptor: OrderDescr; nTimeType: long): long; stdcall;
TRANS2QUIK_ORDER_WITHDRAW_FILETIME = function(orderDescriptor: OrderDescr): FILETIME; stdcall;
TRANS2QUIK_ORDER_VALUE_ENTRY_TYPE = function(orderDescriptor: OrderDescr): long; stdcall;
TRANS2QUIK_ORDER_EXTENDED_FLAGS = function(orderDescriptor: OrderDescr): long; stdcall;
TRANS2QUIK_ORDER_MIN_QTY = function(orderDescriptor: OrderDescr): Quantity; stdcall;
TRANS2QUIK_ORDER_EXEC_TYPE = function(orderDescriptor: OrderDescr): long; stdcall;
TRANS2QUIK_ORDER_AWG_PRICE = function(orderDescriptor: OrderDescr): double; stdcall;
TRANS2QUIK_ORDER_USERID = function(orderDescriptor: OrderDescr): LPTSTR; stdcall;
TRANS2QUIK_ORDER_ACCOUNT = function(orderDescriptor: OrderDescr): LPTSTR; stdcall;
TRANS2QUIK_ORDER_BROKERREF = function(orderDescriptor: OrderDescr): LPTSTR; stdcall;
TRANS2QUIK_ORDER_CLIENT_CODE = function(orderDescriptor: OrderDescr): LPTSTR; stdcall;
TRANS2QUIK_ORDER_FIRMID = function(orderDescriptor: OrderDescr): LPTSTR; stdcall;
TRANS2QUIK_ORDER_REJECT_REASON = function(orderDescriptor: OrderDescr): LPTSTR; stdcall;
TRANS2QUIK_SUBSCRIBE_TRADES = function(ClassCode: LPSTR; Seccodes: LPSTR): long; stdcall;
TRANS2QUIK_UNSUBSCRIBE_TRADES = function(): long; stdcall;
TRANS2QUIK_START_TRADES = function(pfnTradeStatusCallback: TRANS2QUIK_TRADE_STATUS_CALLBACK): long; stdcall;
TRANS2QUIK_TRADE_DATE = function(tradeDescriptor: TradeDescr): long; stdcall;
TRANS2QUIK_TRADE_SETTLE_DATE = function(tradeDescriptor: TradeDescr): long; stdcall;
TRANS2QUIK_TRADE_TIME = function(tradeDescriptor: TradeDescr): long; stdcall;
TRANS2QUIK_TRADE_IS_MARGINAL = function(tradeDescriptor: TradeDescr): long; stdcall;
TRANS2QUIK_TRADE_ACCRUED_INT = function(tradeDescriptor: TradeDescr): double; stdcall;
TRANS2QUIK_TRADE_YIELD = function(tradeDescriptor: TradeDescr): double; stdcall;
TRANS2QUIK_TRADE_TS_COMMISSION = function(tradeDescriptor: TradeDescr): double; stdcall;
TRANS2QUIK_TRADE_CLEARING_CENTER_COMMISSION = function(tradeDescriptor: TradeDescr): double; stdcall;
TRANS2QUIK_TRADE_EXCHANGE_COMMISSION = function(tradeDescriptor: TradeDescr): double; stdcall;
TRANS2QUIK_TRADE_TRADING_SYSTEM_COMMISSION = function(tradeDescriptor: TradeDescr): double; stdcall;
TRANS2QUIK_TRADE_PRICE2 = function(tradeDescriptor: TradeDescr): double; stdcall;
TRANS2QUIK_TRADE_REPO_RATE = function(tradeDescriptor: TradeDescr): double; stdcall;
TRANS2QUIK_TRADE_REPO_VALUE = function(tradeDescriptor: TradeDescr): double; stdcall;
TRANS2QUIK_TRADE_REPO2_VALUE = function(tradeDescriptor: TradeDescr): double; stdcall;
TRANS2QUIK_TRADE_ACCRUED_INT2 = function(tradeDescriptor: TradeDescr): double; stdcall;
TRANS2QUIK_TRADE_REPO_TERM = function(tradeDescriptor: TradeDescr): long; stdcall;
TRANS2QUIK_TRADE_START_DISCOUNT = function(tradeDescriptor: TradeDescr): double; stdcall;
TRANS2QUIK_TRADE_LOWER_DISCOUNT = function(tradeDescriptor: TradeDescr): double; stdcall;
TRANS2QUIK_TRADE_UPPER_DISCOUNT = function(tradeDescriptor: TradeDescr): double; stdcall;
TRANS2QUIK_TRADE_BLOCK_SECURITIES = function(tradeDescriptor: TradeDescr): long; stdcall;
TRANS2QUIK_TRADE_PERIOD = function(tradeDescriptor: TradeDescr): long; stdcall;
TRANS2QUIK_TRADE_KIND = function(tradeDescriptor: TradeDescr): long; stdcall;
TRANS2QUIK_TRADE_FILETIME = function(tradeDescriptor: TradeDescr): FILETIME; stdcall;
TRANS2QUIK_TRADE_DATE_TIME = function(tradeDescriptor: TradeDescr; nTimeType: long): long; stdcall;
TRANS2QUIK_TRADE_BROKER_COMMISSION = function(tradeDescriptor: TradeDescr): double; stdcall;
TRANS2QUIK_TRADE_TRANSID = function(tradeDescriptor: TradeDescr): long; stdcall;
TRANS2QUIK_TRADE_CURRENCY = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
TRANS2QUIK_TRADE_SETTLE_CURRENCY = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
TRANS2QUIK_TRADE_SETTLE_CODE = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
TRANS2QUIK_TRADE_ACCOUNT = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
TRANS2QUIK_TRADE_BROKERREF = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
TRANS2QUIK_TRADE_CLIENT_CODE = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
TRANS2QUIK_TRADE_USERID = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
TRANS2QUIK_TRADE_FIRMID = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
TRANS2QUIK_TRADE_PARTNER_FIRMID = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
TRANS2QUIK_TRADE_EXCHANGE_CODE = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
TRANS2QUIK_TRADE_STATION_ID = function(tradeDescriptor: TradeDescr): LPTSTR; stdcall;
TRANS2QUIK_TRANSACTION_REPLY_CLASS_CODE = function(tradeDescriptor: TransReplyDescr): LPTSTR; stdcall;
TRANS2QUIK_TRANSACTION_REPLY_SEC_CODE = function(tradeDescriptor: TransReplyDescr): LPTSTR; stdcall;
TRANS2QUIK_TRANSACTION_REPLY_PRICE = function(tradeDescriptor: TransReplyDescr): double; stdcall;
TRANS2QUIK_TRANSACTION_REPLY_QUANTITY = function(tradeDescriptor: TransReplyDescr): Quantity; stdcall;
TRANS2QUIK_TRANSACTION_REPLY_BALANCE = function(tradeDescriptor: TransReplyDescr): Quantity; stdcall;
TRANS2QUIK_TRANSACTION_REPLY_FIRMID = function(tradeDescriptor: TransReplyDescr): LPTSTR; stdcall;
TRANS2QUIK_TRANSACTION_REPLY_ACCOUNT = function(tradeDescriptor: TransReplyDescr): LPTSTR; stdcall;
TRANS2QUIK_TRANSACTION_REPLY_CLIENT_CODE = function(tradeDescriptor: TransReplyDescr): LPTSTR; stdcall;
TRANS2QUIK_TRANSACTION_REPLY_BROKERREF = function(tradeDescriptor: TransReplyDescr): LPTSTR; stdcall;
TRANS2QUIK_TRANSACTION_REPLY_EXCHANGE_CODE = function(tradeDescriptor: TransReplyDescr): LPTSTR; stdcall;
var
T2QConnStatCallBack: TRANS2QUIK_CONNECTION_STATUS_CALLBACK;
T2QTransReplyCallBack: TRANS2QUIK_TRANSACTION_REPLY_CALLBACK;
T2QOrderStatCallBack: TRANS2QUIK_ORDER_STATUS_CALLBACK;
T2QTradeStatCallBack: TRANS2QUIK_TRADE_STATUS_CALLBACK;
T2QSendSyncTrans: TRANS2QUIK_SEND_SYNC_TRANSACTION;
T2QSendASyncTrans: TRANS2QUIK_SEND_ASYNC_TRANSACTION;
T2QConnect: TRANS2QUIK_CONNECT;
T2QDisconnect: TRANS2QUIK_DISCONNECT;
T2QSetConnStatCallBAck: TRANS2QUIK_SET_CONNECTION_STATUS_CALLBACK;
T2QSetTransReplyCallBAck: TRANS2QUIK_SET_TRANSACTIONS_REPLY_CALLBACK;
T2QIsQuikConnected: TRANS2QUIK_IS_QUIK_CONNECTED;
T2QIsDllConnected: TRANS2QUIK_IS_DLL_CONNECTED;
T2QSubscribeOrders: TRANS2QUIK_SUBSCRIBE_ORDERS;
T2QUnSubscribeOrders: TRANS2QUIK_UNSUBSCRIBE_ORDERS;
T2QStartOrders: TRANS2QUIK_START_ORDERS;
T2QOrderQty: TRANS2QUIK_ORDER_QTY;
T2QOrderDate: TRANS2QUIK_ORDER_DATE;
T2QOrderTime: TRANS2QUIK_ORDER_TIME;
T2QOrderActiveTime: TRANS2QUIK_ORDER_ACTIVATION_TIME;
T2QOrderWithdrawTime: TRANS2QUIK_ORDER_WITHDRAW_TIME;
T2QOrderExpiry: TRANS2QUIK_ORDER_EXPIRY;
T2QOrderAccruedInt: TRANS2QUIK_ORDER_ACCRUED_INT;
T2QOrderYield: TRANS2QUIK_ORDER_YIELD;
T2QOrderUid: TRANS2QUIK_ORDER_UID;
T2QOrderVisibleQty: TRANS2QUIK_ORDER_VISIBLE_QTY;
T2QOrderPeriod: TRANS2QUIK_ORDER_PERIOD;
T2QOrderFileTime: TRANS2QUIK_ORDER_FILETIME;
T2QOrderDateTime: TRANS2QUIK_ORDER_DATE_TIME;
T2QOrderWithdrawFileTime: TRANS2QUIK_ORDER_WITHDRAW_FILETIME;
T2QOrderValueEntryType: TRANS2QUIK_ORDER_VALUE_ENTRY_TYPE;
T2QOrderExtdFlags: TRANS2QUIK_ORDER_EXTENDED_FLAGS;
T2QOrderMinQty: TRANS2QUIK_ORDER_MIN_QTY;
T2QOrderExecType: TRANS2QUIK_ORDER_EXEC_TYPE;
T2QOrderAwgPrice: TRANS2QUIK_ORDER_AWG_PRICE;
T2QOrderUserId: TRANS2QUIK_ORDER_USERID;
T2QOrderAccaunt: TRANS2QUIK_ORDER_ACCOUNT;
T2QOrderBrokerRef: TRANS2QUIK_ORDER_BROKERREF;
T2QOrderClientCode: TRANS2QUIK_ORDER_CLIENT_CODE;
T2QOrderFirmId: TRANS2QUIK_ORDER_FIRMID;
T2QOrderRejectReason: TRANS2QUIK_ORDER_REJECT_REASON;
T2QSubscribeTrades: TRANS2QUIK_SUBSCRIBE_TRADES;
T2QUnSubscribeTrades: TRANS2QUIK_UNSUBSCRIBE_TRADES;
T2QStartTrades: TRANS2QUIK_START_TRADES;
T2QTradeDate: TRANS2QUIK_TRADE_DATE;
T2QTradeSettleDate: TRANS2QUIK_TRADE_SETTLE_DATE;
T2QTradeTime: TRANS2QUIK_TRADE_TIME;
T2QTradeIsMarginal: TRANS2QUIK_TRADE_IS_MARGINAL;
T2QTradeAccruedInt: TRANS2QUIK_TRADE_ACCRUED_INT;
T2QTradeYield: TRANS2QUIK_TRADE_YIELD;
T2QTradeTSCommission: TRANS2QUIK_TRADE_TS_COMMISSION;
T2QTradeClCenterCommission: TRANS2QUIK_TRADE_CLEARING_CENTER_COMMISSION;
T2QTradeExcCommission: TRANS2QUIK_TRADE_EXCHANGE_COMMISSION;
T2QTradeTrSysCommission: TRANS2QUIK_TRADE_TRADING_SYSTEM_COMMISSION;
T2QTradePrice2: TRANS2QUIK_TRADE_PRICE2;
T2QTradeRepoRate: TRANS2QUIK_TRADE_REPO_RATE;
T2QTradeRepoValue: TRANS2QUIK_TRADE_REPO_VALUE;
T2QTradeRepo2Value: TRANS2QUIK_TRADE_REPO2_VALUE;
T2QTradeAccruedInt2: TRANS2QUIK_TRADE_ACCRUED_INT2;
T2QTradeRepoTerm: TRANS2QUIK_TRADE_REPO_TERM;
T2QTradeStDiscount: TRANS2QUIK_TRADE_START_DISCOUNT;
T2QTradeLwDiscount: TRANS2QUIK_TRADE_LOWER_DISCOUNT;
T2QTradeUpDiscount: TRANS2QUIK_TRADE_UPPER_DISCOUNT;
T2QTradeBlSecur: TRANS2QUIK_TRADE_BLOCK_SECURITIES;
T2QTradePeriod: TRANS2QUIK_TRADE_PERIOD;
T2QTradeKind: TRANS2QUIK_TRADE_KIND;
T2QTradeFileName: TRANS2QUIK_TRADE_FILETIME;
T2QTradeDateTime: TRANS2QUIK_TRADE_DATE_TIME;
T2QTradeBrCommission: TRANS2QUIK_TRADE_BROKER_COMMISSION;
T2QTradeTransId: TRANS2QUIK_TRADE_TRANSID;
T2QTradeCurrensy: TRANS2QUIK_TRADE_CURRENCY;
T2QTradeSettlCurr: TRANS2QUIK_TRADE_SETTLE_CURRENCY;
T2QTradeSettlCode: TRANS2QUIK_TRADE_SETTLE_CODE;
T2QTradeAccount: TRANS2QUIK_TRADE_ACCOUNT;
T2QTradeBrRef: TRANS2QUIK_TRADE_BROKERREF;
T2QTradeClCode: TRANS2QUIK_TRADE_CLIENT_CODE;
T2QTradeUserId: TRANS2QUIK_TRADE_USERID;
T2QTradeFirmId: TRANS2QUIK_TRADE_FIRMID;
T2QTradePartFirmId: TRANS2QUIK_TRADE_PARTNER_FIRMID;
T2QTradeExcCode: TRANS2QUIK_TRADE_EXCHANGE_CODE;
T2QTradeStationId: TRANS2QUIK_TRADE_STATION_ID;
T2QTransReplyClassCode: TRANS2QUIK_TRANSACTION_REPLY_CLASS_CODE;
T2QTransReplySecCode: TRANS2QUIK_TRANSACTION_REPLY_SEC_CODE;
T2QTransReplyPrice: TRANS2QUIK_TRANSACTION_REPLY_PRICE;
T2QTransReplyQty: TRANS2QUIK_TRANSACTION_REPLY_QUANTITY;
T2QTransReplyBal: TRANS2QUIK_TRANSACTION_REPLY_BALANCE;
T2QTransReplyFirmId: TRANS2QUIK_TRANSACTION_REPLY_FIRMID;
T2QTransReplyAccount: TRANS2QUIK_TRANSACTION_REPLY_ACCOUNT;
T2QTransReplyClCode: TRANS2QUIK_TRANSACTION_REPLY_CLIENT_CODE;
T2QTransReplyBrRef: TRANS2QUIK_TRANSACTION_REPLY_BROKERREF;
T2QTransReplyExcCode: TRANS2QUIK_TRANSACTION_REPLY_EXCHANGE_CODE;
implementation
function LibLoad(const aPath: string): THandle;
begin
Result:= LoadLibrary(PWideChar(IncludeTrailingPathDelimiter(aPath) + DllName));
@T2QSendSyncTrans := GetProcAddress(Result, PWideChar('TRANS2QUIK_SEND_SYNC_TRANSACTION'));
if(addr(T2QSendSyncTrans) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QSendASyncTrans := GetProcAddress(Result, PWideChar('TRANS2QUIK_SEND_ASYNC_TRANSACTION'));
if(addr(T2QSendASyncTrans) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QConnect:= GetProcAddress(Result, PWideChar('TRANS2QUIK_CONNECT'));
if(addr(T2QConnect) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QDisconnect := GetProcAddress(Result, PWideChar('TRANS2QUIK_DISCONNECT'));
if(addr(T2QDisconnect) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QSetConnStatCallBAck := GetProcAddress(Result, PWideChar('TRANS2QUIK_SET_CONNECTION_STATUS_CALLBACK'));
if(addr(T2QSetConnStatCallBAck) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QSetTransReplyCallBAck := GetProcAddress(Result, PWideChar('TRANS2QUIK_SET_TRANSACTIONS_REPLY_CALLBACK'));
if(addr(T2QSetTransReplyCallBAck) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QIsQuikConnected := GetProcAddress(Result, PWideChar('TRANS2QUIK_IS_QUIK_CONNECTED'));
if(addr(T2QIsQuikConnected) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QIsDllConnected := GetProcAddress(Result, PWideChar('TRANS2QUIK_IS_DLL_CONNECTED'));
if(addr(T2QIsDllConnected) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QSubscribeOrders := GetProcAddress(Result, PWideChar('TRANS2QUIK_SUBSCRIBE_ORDERS'));
if(addr(T2QSubscribeOrders) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QUnSubscribeOrders := GetProcAddress(Result, PWideChar('TRANS2QUIK_UNSUBSCRIBE_ORDERS'));
if(addr(T2QUnSubscribeOrders) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QStartOrders := GetProcAddress(Result, PWideChar('TRANS2QUIK_START_ORDERS'));
if(addr(T2QStartOrders) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderQty := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_QTY'));
if(addr(T2QOrderQty) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderDate := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_DATE'));
if(addr(T2QOrderDate) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_TIME'));
if(addr(T2QOrderTime) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderActiveTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_ACTIVATION_TIME'));
if(addr(T2QOrderActiveTime) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderWithdrawTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_WITHDRAW_TIME'));
if(addr(T2QOrderWithdrawTime) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderExpiry := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_EXPIRY'));
if(addr(T2QOrderExpiry) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderAccruedInt := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_ACCRUED_INT'));
if(addr(T2QOrderAccruedInt) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderYield := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_YIELD'));
if(addr(T2QOrderYield) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderUid := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_UID'));
if(addr(T2QOrderUid) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderVisibleQty := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_VISIBLE_QTY'));
if(addr(T2QOrderVisibleQty) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderPeriod := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_PERIOD'));
if(addr(T2QOrderPeriod) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderFileTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_FILETIME'));
if(addr(T2QOrderFileTime) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderDateTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_DATE_TIME'));
if(addr(T2QOrderDateTime) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderWithdrawFileTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_WITHDRAW_FILETIME'));
if(addr(T2QOrderWithdrawFileTime) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderValueEntryType := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_VALUE_ENTRY_TYPE'));
if(addr(T2QOrderValueEntryType) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderExtdFlags := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_EXTENDED_FLAGS'));
if(addr(T2QOrderExtdFlags) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderMinQty := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_MIN_QTY'));
if(addr(T2QOrderMinQty) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderExecType := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_EXEC_TYPE'));
if(addr(T2QOrderExecType) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderAwgPrice := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_AWG_PRICE'));
if(addr(T2QOrderAwgPrice) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderUserId := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_USERID'));
if(addr(T2QOrderUserId) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderAccaunt := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_ACCOUNT'));
if(addr(T2QOrderAccaunt) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderBrokerRef := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_BROKERREF'));
if(addr(T2QOrderBrokerRef) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderClientCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_CLIENT_CODE'));
if(addr(T2QOrderClientCode) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderFirmId := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_FIRMID'));
if(addr(T2QOrderFirmId) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QOrderRejectReason := GetProcAddress(Result, PWideChar('TRANS2QUIK_ORDER_REJECT_REASON'));
if(addr(T2QOrderRejectReason) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QSubscribeTrades := GetProcAddress(Result, PWideChar('TRANS2QUIK_SUBSCRIBE_TRADES'));
if(addr(T2QSubscribeTrades) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QUnSubscribeTrades := GetProcAddress(Result, PWideChar('TRANS2QUIK_UNSUBSCRIBE_TRADES'));
if(addr(T2QUnSubscribeTrades) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QStartTrades := GetProcAddress(Result, PWideChar('TRANS2QUIK_START_TRADES'));
if(addr(T2QStartTrades) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeDate := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_DATE'));
if(addr(T2QTradeDate) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeSettleDate := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_SETTLE_DATE'));
if(addr(T2QTradeSettleDate) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_TIME'));
if(addr(T2QTradeTime) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeIsMarginal := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_IS_MARGINAL'));
if(addr(T2QTradeIsMarginal) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeAccruedInt := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_ACCRUED_INT'));
if(addr(T2QTradeAccruedInt) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeYield := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_YIELD'));
if(addr(T2QTradeYield) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeTSCommission := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_TS_COMMISSION'));
if(addr(T2QTradeTSCommission) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeClCenterCommission := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_TS_COMMISSION'));
if(addr(T2QTradeClCenterCommission) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeExcCommission := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_EXCHANGE_COMMISSION'));
if(addr(T2QTradeExcCommission) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeTrSysCommission := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_TRADING_SYSTEM_COMMISSION'));
if(addr(T2QTradeTrSysCommission) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradePrice2 := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_PRICE2'));
if(addr(T2QTradePrice2) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeRepoRate := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_REPO_RATE'));
if(addr(T2QTradeRepoRate) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeRepoValue := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_REPO_VALUE'));
if(addr(T2QTradeRepoValue) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeRepo2Value := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_REPO2_VALUE'));
if(addr(T2QTradeRepo2Value) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeAccruedInt2 := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_ACCRUED_INT2'));
if(addr(T2QTradeAccruedInt2) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeRepoTerm := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_REPO_TERM'));
if(addr(T2QTradeRepoTerm) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeStDiscount := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_START_DISCOUNT'));
if(addr(T2QTradeStDiscount) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeLwDiscount := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_LOWER_DISCOUNT'));
if(addr(T2QTradeLwDiscount) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeUpDiscount := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_UPPER_DISCOUNT'));
if(addr(T2QTradeUpDiscount) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeBlSecur := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_UPPER_DISCOUNT'));
if(addr(T2QTradeBlSecur) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradePeriod := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_PERIOD'));
if(addr(T2QTradePeriod) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeKind := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_KIND'));
if(addr(T2QTradeKind) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeFileName := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_FILETIME'));
if(addr(T2QTradeFileName) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeDateTime := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_DATE_TIME'));
if(addr(T2QTradeDateTime) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeBrCommission := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_BROKER_COMMISSION'));
if(addr(T2QTradeBrCommission) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeTransId := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_TRANSID'));
if(addr(T2QTradeTransId) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeCurrensy := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_CURRENCY'));
if(addr(T2QTradeCurrensy) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeSettlCurr := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_SETTLE_CURRENCY'));
if(addr(T2QTradeSettlCurr) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeSettlCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_SETTLE_CODE'));
if(addr(T2QTradeSettlCode) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeAccount := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_ACCOUNT'));
if(addr(T2QTradeAccount) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeBrRef := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_BROKERREF'));
if(addr(T2QTradeBrRef) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeClCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_CLIENT_CODE'));
if(addr(T2QTradeClCode) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeUserId := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_USERID'));
if(addr(T2QTradeUserId) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeFirmId := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_FIRMID'));
if(addr(T2QTradeFirmId) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradePartFirmId := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_PARTNER_FIRMID'));
if(addr(T2QTradePartFirmId) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeExcCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_EXCHANGE_CODE'));
if(addr(T2QTradeExcCode) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTradeStationId := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRADE_STATION_ID'));
if(addr(T2QTradeStationId) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTransReplyClassCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_CLASS_CODE'));
if(addr(T2QTransReplyClassCode) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTransReplySecCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_SEC_CODE'));
if(addr(T2QTransReplySecCode) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTransReplyPrice := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_PRICE'));
if(addr(T2QTransReplyPrice) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTransReplyQty := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_QUANTITY'));
if(addr(T2QTransReplyQty) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTransReplyBal := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_BALANCE'));
if(addr(T2QTransReplyBal) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTransReplyFirmId := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_FIRMID'));
if(addr(T2QTransReplyFirmId) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTransReplyAccount := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_ACCOUNT'));
if(addr(T2QTransReplyAccount) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTransReplyClCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_CLIENT_CODE'));
if(addr(T2QTransReplyClCode) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTransReplyBrRef := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_BROKERREF'));
if(addr(T2QTransReplyBrRef) = nil) then
begin
Result:= 0;
Exit;
end;
@T2QTransReplyExcCode := GetProcAddress(Result, PWideChar('TRANS2QUIK_TRANSACTION_REPLY_EXCHANGE_CODE'));
if(addr(T2QTransReplyExcCode) = nil) then
begin
Result:= 0;
Exit;
end;
end;
end.
Всё нормально, хендл получен адреса функций тоже ОК,
но, при вызове функции
//--- load trsns2quik.dll ----
if (QuikPath <> '') then
FDllHandle:= LibLoad(QuikPath);
if(DllHandle > 0) then
begin
if(addr(T2QConnect) <> nil) then
res:= T2QConnect(PAnsiChar(RawByteString(QuikPath + '\info.exe')), ErrCode, ErrStr, ErrSize);
end;
Получаю ACCESS VIOLATION
Почему?