Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Delphi code to Python
#3
Hey guys!

Anyone can help me, I'm trying to write this C code in python, but I don't know how to do.

I'm stuck in this code I loose a lot of hours.
/////////////////////////////////////////////////////////////////////////////
// WARNING: Não utilizar funções da dll dentro do CALLBACK
////////////////////////////////////////////////////////////////////////////////
//Callback do stado das diferentes conexões
typedef void (__stdcall *TStateCallback)(int nResult, int result);
////////////////////////////////////////////////////////////////////////////////
//Callback com informações marketData
typedef void (__stdcall *TNewTradeCallback)(TAssetID assetId, wchar_t* date, float price, float vol, int qtd, int buyAgent, int sellAgent, int tradeType);
typedef void (__stdcall *TNewDailyCallback)(TAssetID TAssetIDRec, wchar_t* date, float sOpen, float sHigh, float sLow, float sClose, float sVol, float sAjuste, float sMaxLimit, float sMinLimit, int sVolBuyer, int sVolSeller, int nQtd, int nNegocios, int nContratosOpen, int nQtdBuyer, int nQtdSeller, int nNegBuyer, int nNegSeller);
typedef void(__stdcall *TNewHistoryCallback)(TAssetID assetId, wchar_t* date, float price, float vol, int qtd, int buyAgent, int sellAgent, int tradeType);
typedef void(__stdcall *TProgressCallBack)(TAssetID assetId, int nProgress);
typedef void(__stdcall *TNewTinyBookCallBack)(TAssetID assetId, float price, int qtd, int side);
////////////////////////////////////////////////////////////////////////////////
// Functions From ProfitDLL
extern "C" {
	typedef signed char (__stdcall *InitializeMarket)(const wchar_t *activationKey,
                                                   TStateCallback stateCallback,
                                                   TNewTradeCallback newTradeCallback,
                                                   TNewDailyCallback newDailyCallback,
                                                   TNewHistoryCallback newHistoryCallback,
                                                   TProgressCallBack progressCallBack,
                                                   TNewTinyBookCallBack newTinyBookCallBack);
	typedef signed char (__stdcall *Finalize)();
	typedef signed char (__stdcall *SubscribeTicker)(const wchar_t *ticker, const wchar_t *bolsa);
	typedef signed char (__stdcall *UnsubscribeTicker)(const wchar_t *ticker, const wchar_t *bolsa);
	typedef wchar_t* (__stdcall *GetAgentNameByID)(int nID);
	typedef wchar_t* (__stdcall *GetAgentShortNameByID)(int nID);
	typedef signed char(__stdcall *GetHistoryTradesInInterval)(const wchar_t *pwcTicker, const wchar_t *bolsa,  wchar_t* dateStart, wchar_t* dateTimeStart);
}
// #Functions
// Error Codes
const signed char NL_OK = 0;     // OK
//const signed char NL_LOGIN_INVALID = [1..4];  // LOGIN INVALID
const signed char NL_ERR_INIT = 80;     // Not initialized
const signed char NL_ERR_INVALID_ARGS = 90;     // Invalid arguments
const signed char NL_ERR_INTERNAL_ERROR = 100;     // Internal error

bool g_Activated = false;

//////////////////////////////////////////////////////////////////////////////
// DLL Functions
InitializeMarket g_initialize;
Finalize g_finalize;
SubscribeTicker g_subscribe;
UnsubscribeTicker g_unsubscribe;
GetAgentNameByID g_getAgentName;
GetAgentShortNameByID g_getAgentShortName;
Reply


Messages In This Thread
Delphi code to Python - by juliocsrj84 - Dec-20-2018, 01:47 PM
RE: Delphi code to Python - by nilamo - Dec-20-2018, 08:03 PM
RE: Delphi code to Python - by juliocsrj84 - Dec-23-2018, 09:44 PM
RE: Delphi code to Python - by Gribouillis - Dec-23-2018, 10:12 PM
RE: Delphi code to Python - by juliocsrj84 - Dec-26-2018, 01:47 PM
RE: Delphi code to Python - by nilamo - Dec-26-2018, 04:57 PM
RE: Delphi code to Python - by juliocsrj84 - Dec-26-2018, 07:31 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020