MT5APIClient.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. //+------------------------------------------------------------------+
  2. //| MetaTrader 5 API |
  3. //| Copyright 2000-2019, MetaQuotes Software Corp. |
  4. //| http://www.metaquotes.net |
  5. //+------------------------------------------------------------------+
  6. #pragma once
  7. //+------------------------------------------------------------------+
  8. //| Client record interface |
  9. //+------------------------------------------------------------------+
  10. class IMTClient
  11. {
  12. public:
  13. //--- genders
  14. enum EnGender
  15. {
  16. GENDER_UNSPECIFIED =0, // unspecified
  17. GENDER_MALE =1, // male
  18. GENDER_FEMALE =2, // female
  19. //--- enumeration borders
  20. GENDER_FIRST =GENDER_UNSPECIFIED,
  21. GENDER_LAST =GENDER_FEMALE
  22. };
  23. //--- client types
  24. enum EnClientType
  25. {
  26. CLIENT_TYPE_UNDEFINED =0, // undefined
  27. CLIENT_TYPE_INDIVIDUAL =1, // individual person
  28. CLIENT_TYPE_CORPORATE =2, // corporate
  29. CLIENT_TYPE_FUND =3, // fund
  30. //--- enumeration borders
  31. CLIENT_TYPE_FIRST =CLIENT_TYPE_UNDEFINED,
  32. CLIENT_TYPE_LAST =CLIENT_TYPE_FUND
  33. };
  34. //--- client statuses
  35. enum EnClientStatus
  36. {
  37. //--- demo account registered
  38. CLIENT_STATUS_UNREGISTERED =0, // anonymous client (demo account without any data)
  39. CLIENT_STATUS_REGISTERED =100, // client that opened demo account and filled contact data
  40. CLIENT_STATUS_NOTINTERESTED =200, // client that opened demo account and filled contact data, but doesn't have interest to open real account
  41. //--- preliminary account registered
  42. CLIENT_STATUS_APPLICATION_INCOMPLETED=300, // client that filled data for real account
  43. CLIENT_STATUS_APPLICATION_COMPLETED =400, // client that filled data for real account and attached all documents
  44. CLIENT_STATUS_APPLICATION_INFORMATION=500, // need more information for next processing to open real account
  45. CLIENT_STATUS_APPLICATION_REJECTED =600, // client was rejected
  46. //--- client
  47. CLIENT_STATUS_APPROVED =700, // client with real account
  48. CLIENT_STATUS_FUNDED =800, // client that was funded his real account
  49. CLIENT_STATUS_ACTIVE =900, // client that have trading activity for some period
  50. CLIENT_STATUS_INACTIVE =1000, // client that haven't trading activity for some period
  51. CLIENT_STATUS_SUSPENDED =1100, // client that was suspended
  52. //--- closed
  53. CLIENT_STATUS_CLOSED =1200, // closed by himself
  54. CLIENT_STATUS_TERMINATED =1300, // closed by company
  55. //--- enumeration borders
  56. CLIENT_STATUS_FIRST =CLIENT_STATUS_UNREGISTERED,
  57. CLIENT_STATUS_LAST =CLIENT_STATUS_TERMINATED
  58. };
  59. //--- preferred communications
  60. enum EnPreferredCommunication
  61. {
  62. PREFERRED_COMMUNICATION_UNDEFINED =0, // undefined
  63. PREFERRED_COMMUNICATION_EMAIL =1, // email
  64. PREFERRED_COMMUNICATION_PHONE =2, // phone
  65. PREFERRED_COMMUNICATION_PHONE_SMS =3, // SMS
  66. PREFERRED_COMMUNICATION_MESSENGER =4, // messenger
  67. //--- enumeration borders
  68. PREFERRED_COMMUNICATION_FIRST =PREFERRED_COMMUNICATION_UNDEFINED,
  69. PREFERRED_COMMUNICATION_LAST =PREFERRED_COMMUNICATION_MESSENGER,
  70. };
  71. //--- experiences
  72. enum EnTradingExperience
  73. {
  74. EXPERIENCE_LESS_1_YEAR =0, // less than one year
  75. EXPERIENCE_1_3_YEAR =1, // from one to three years
  76. EXPERIENCE_ABOVE_3_YEAR =2, // above three years
  77. //--- enumeration borders
  78. EXPERIENCE_FIRST =EXPERIENCE_LESS_1_YEAR,
  79. EXPERIENCE_LAST =EXPERIENCE_ABOVE_3_YEAR,
  80. };
  81. //--- employments
  82. enum EnEmployment
  83. {
  84. EMPLOYMENT_UNEMPLOYED =0, // unemployed
  85. EMPLOYMENT_EMPLOYED =1, // employed
  86. EMPLOYMENT_SELF_EMPLOYED =2, // self employed
  87. EMPLOYMENT_RETIRED =3, // retired
  88. EMPLOYMENT_STUDENT =4, // student
  89. EMPLOYMENT_OTHER =5, // other
  90. //--- enumeration borders
  91. EMPLOYMENT_FIRST =EMPLOYMENT_UNEMPLOYED,
  92. EMPLOYMENT_LAST =EMPLOYMENT_OTHER
  93. };
  94. //--- employment industries
  95. enum EnEmploymentIndustry
  96. {
  97. INDUSTRY_NONE =0, // none
  98. INDUSTRY_AGRICULTURE =1, // agriculture
  99. INDUSTRY_CONSTRUCTION =2, // construction
  100. INDUSTRY_MANAGEMENT =3, // management
  101. INDUSTRY_COMMUNICATION =4, // communication
  102. INDUSTRY_EDUCATION =5, // education
  103. INDUSTRY_GOVERNMENT =6, // government
  104. INDUSTRY_HEALTHCARE =7, // health care
  105. INDUSTRY_TOURISM =8, // tourism
  106. INDUSTRY_IT =9, // IT
  107. INDUSTRY_SECURITY =10, // security
  108. INDUSTRY_MANUFACTURING =11, // manufacturing
  109. INDUSTRY_MARKETING =12, // marketing
  110. INDUSTRY_SCIENCE =13, // science
  111. INDUSTRY_ENGINEERING =14, // engineering
  112. INDUSTRY_TRANSPORT =15, // transport
  113. INDUSTRY_OTHER =16, // other
  114. //--- enumeration borders
  115. INDUSTRY_FIRST =INDUSTRY_AGRICULTURE,
  116. INDUSTRY_LAST =INDUSTRY_OTHER
  117. };
  118. //--- education levels
  119. enum EnEducationLevel
  120. {
  121. EDUCATION_LEVEL_NONE =0, // none
  122. EDUCATION_LEVEL_HIGH_SCHOOL =1, // high school
  123. EDUCATION_LEVEL_BACHELOR =2, // bachelor
  124. EDUCATION_LEVEL_MASTER =3, // master
  125. EDUCATION_LEVEL_PHD =4, // PHD
  126. EDUCATION_LEVEL_OTHER =5, // other
  127. //--- enumeration borders
  128. EDUCATION_LEVEL_FIRST =EDUCATION_LEVEL_NONE,
  129. EDUCATION_LEVEL_LAST =EDUCATION_LEVEL_OTHER
  130. };
  131. //--- wealth sources
  132. enum EnWealthSource
  133. {
  134. WEALTH_SOURCE_EMPLOYMENT =0, // employment
  135. WEALTH_SOURCE_SAVINGS =1, // savings
  136. WEALTH_SOURCE_INHERITANCE =2, // inheritance
  137. WEALTH_SOURCE_OTHER =3, // other
  138. //--- enumeration borders
  139. WEALTH_SOURCE_FIRST =WEALTH_SOURCE_EMPLOYMENT,
  140. WEALTH_SOURCE_LAST =WEALTH_SOURCE_OTHER
  141. };
  142. //--- client origins
  143. enum EnClientOrigin
  144. {
  145. CLIENT_ORIGIN_MANUAL =0, // manual created
  146. CLIENT_ORIGIN_DEMO =1, // automatic was created from demo account
  147. CLIENT_ORIGIN_CONTEST =2, // automatic was created from contest account
  148. CLIENT_ORIGIN_PRELIMINARY =3, // automatic was created from preliminary account
  149. CLIENT_ORIGIN_REAL =4, // automatic was created from real account
  150. //--- enumeration borders
  151. CLIENT_ORIGIN_FIRST =CLIENT_ORIGIN_MANUAL,
  152. CLIENT_ORIGIN_LAST =CLIENT_ORIGIN_REAL,
  153. };
  154. //--- common methods
  155. virtual void Release(void)=0;
  156. virtual MTAPIRES Assign(const IMTClient* client)=0;
  157. virtual MTAPIRES Clear(void)=0;
  158. //--- record id
  159. virtual UINT64 RecordID(void) const=0;
  160. virtual MTAPIRES RecordID(const UINT64 record_id)=0;
  161. //--- client type
  162. virtual UINT ClientType(void) const=0;
  163. virtual MTAPIRES ClientType(const UINT type)=0;
  164. //--- client status
  165. virtual UINT ClientStatus(void) const=0;
  166. virtual MTAPIRES ClientStatus(const UINT status)=0;
  167. //--- assigned manager
  168. virtual UINT64 AssignedManager(void) const=0;
  169. virtual MTAPIRES AssignedManager(const UINT64 manager)=0;
  170. //--- compliance approved by
  171. virtual UINT64 ComplianceApprovedBy(void) const=0;
  172. virtual MTAPIRES ComplianceApprovedBy(const UINT64 manager)=0;
  173. //--- compliance client category
  174. virtual LPCWSTR ComplianceClientCategory(void) const=0;
  175. virtual MTAPIRES ComplianceClientCategory(LPCWSTR category)=0;
  176. //--- compliance date approval
  177. virtual INT64 ComplianceDateApproval(void) const=0;
  178. virtual MTAPIRES ComplianceDateApproval(const INT64 date)=0;
  179. //--- compliance date termination
  180. virtual INT64 ComplianceDateTermination(void) const=0;
  181. virtual MTAPIRES ComplianceDateTermination(const INT64 date)=0;
  182. //--- lead campaign
  183. virtual LPCWSTR LeadCampaign(void) const=0;
  184. virtual MTAPIRES LeadCampaign(LPCWSTR campaign)=0;
  185. //--- lead source
  186. virtual LPCWSTR LeadSource(void) const=0;
  187. virtual MTAPIRES LeadSource(LPCWSTR source)=0;
  188. //--- introducer
  189. virtual LPCWSTR Introducer(void) const=0;
  190. virtual MTAPIRES Introducer(LPCWSTR introducer)=0;
  191. //--- person title
  192. virtual LPCWSTR PersonTitle(void) const=0;
  193. virtual MTAPIRES PersonTitle(LPCWSTR title)=0;
  194. //--- person name
  195. virtual LPCWSTR PersonName(void) const=0;
  196. virtual MTAPIRES PersonName(LPCWSTR name)=0;
  197. //--- person middle name
  198. virtual LPCWSTR PersonMiddleName(void) const=0;
  199. virtual MTAPIRES PersonMiddleName(LPCWSTR middle_name)=0;
  200. //--- person last name
  201. virtual LPCWSTR PersonLastName(void) const=0;
  202. virtual MTAPIRES PersonLastName(LPCWSTR last_name)=0;
  203. //--- person birth date
  204. virtual INT64 PersonBirthDate(void) const=0;
  205. virtual MTAPIRES PersonBirthDate(const INT64 date)=0;
  206. //--- person citizenship
  207. virtual LPCWSTR PersonCitizenship(void) const=0;
  208. virtual MTAPIRES PersonCitizenship(LPCWSTR citizenship)=0;
  209. //--- person gender
  210. virtual UINT PersonGender(void) const=0;
  211. virtual MTAPIRES PersonGender(const UINT gender)=0;
  212. //--- person taxid
  213. virtual LPCWSTR PersonTaxID(void) const=0;
  214. virtual MTAPIRES PersonTaxID(LPCWSTR taxid)=0;
  215. //--- person document type
  216. virtual LPCWSTR PersonDocumentType(void) const=0;
  217. virtual MTAPIRES PersonDocumentType(LPCWSTR type)=0;
  218. //--- person document number
  219. virtual LPCWSTR PersonDocumentNumber(void) const=0;
  220. virtual MTAPIRES PersonDocumentNumber(LPCWSTR number)=0;
  221. //--- person document date
  222. virtual INT64 PersonDocumentDate(void) const=0;
  223. virtual MTAPIRES PersonDocumentDate(const INT64 date)=0;
  224. //--- person document extra
  225. virtual LPCWSTR PersonDocumentExtra(void) const=0;
  226. virtual MTAPIRES PersonDocumentExtra(LPCWSTR extra)=0;
  227. //--- person employment
  228. virtual UINT PersonEmployment(void) const=0;
  229. virtual MTAPIRES PersonEmployment(const UINT employment)=0;
  230. //--- person industry
  231. virtual UINT PersonIndustry(void) const=0;
  232. virtual MTAPIRES PersonIndustry(const UINT industry)=0;
  233. //--- person education
  234. virtual UINT PersonEducation(void) const=0;
  235. virtual MTAPIRES PersonEducation(const UINT education)=0;
  236. //--- person wealth source
  237. virtual UINT PersonWealthSource(void) const=0;
  238. virtual MTAPIRES PersonWealthSource(const UINT source)=0;
  239. //--- person annual income
  240. virtual double PersonAnnualIncome(void) const=0;
  241. virtual MTAPIRES PersonAnnualIncome(const double income)=0;
  242. //--- person net worth
  243. virtual double PersonNetWorth(void) const=0;
  244. virtual MTAPIRES PersonNetWorth(const double worth)=0;
  245. //--- person annual deposit
  246. virtual double PersonAnnualDeposit(void) const=0;
  247. virtual MTAPIRES PersonAnnualDeposit(const double deposit)=0;
  248. //--- company name
  249. virtual LPCWSTR CompanyName(void) const=0;
  250. virtual MTAPIRES CompanyName(LPCWSTR name)=0;
  251. //--- company registration number
  252. virtual LPCWSTR CompanyRegNumber(void) const=0;
  253. virtual MTAPIRES CompanyRegNumber(LPCWSTR number)=0;
  254. //--- company registration date
  255. virtual INT64 CompanyRegDate(void) const=0;
  256. virtual MTAPIRES CompanyRegDate(const INT64 date)=0;
  257. //--- company registration authority
  258. virtual LPCWSTR CompanyRegAuthority(void) const=0;
  259. virtual MTAPIRES CompanyRegAuthority(LPCWSTR authority)=0;
  260. //--- company VAT
  261. virtual LPCWSTR CompanyVat(void) const=0;
  262. virtual MTAPIRES CompanyVat(LPCWSTR vat)=0;
  263. //--- company LEI
  264. virtual LPCWSTR CompanyLei(void) const=0;
  265. virtual MTAPIRES CompanyLei(LPCWSTR lei)=0;
  266. //--- company license number
  267. virtual LPCWSTR CompanyLicenseNumber(void) const=0;
  268. virtual MTAPIRES CompanyLicenseNumber(LPCWSTR number)=0;
  269. //--- company license authority
  270. virtual LPCWSTR CompanyLicenseAuthority(void) const=0;
  271. virtual MTAPIRES CompanyLicenseAuthority(LPCWSTR authority)=0;
  272. //--- company country
  273. virtual LPCWSTR CompanyCountry(void) const=0;
  274. virtual MTAPIRES CompanyCountry(LPCWSTR country)=0;
  275. //--- company address
  276. virtual LPCWSTR CompanyAddress(void) const=0;
  277. virtual MTAPIRES CompanyAddress(LPCWSTR address)=0;
  278. //--- company website
  279. virtual LPCWSTR CompanyWebsite(void) const=0;
  280. virtual MTAPIRES CompanyWebsite(LPCWSTR website)=0;
  281. //--- contact preferred
  282. virtual UINT ContactPreferred(void) const=0;
  283. virtual MTAPIRES ContactPreferred(const UINT preferred)=0;
  284. //--- contact language
  285. virtual LPCWSTR ContactLanguage(void) const=0;
  286. virtual MTAPIRES ContactLanguage(LPCWSTR language)=0;
  287. //--- contact email
  288. virtual LPCWSTR ContactEmail(void) const=0;
  289. virtual MTAPIRES ContactEmail(LPCWSTR email)=0;
  290. //--- contact phone
  291. virtual LPCWSTR ContactPhone(void) const=0;
  292. virtual MTAPIRES ContactPhone(LPCWSTR phone)=0;
  293. //--- contact messengers
  294. virtual LPCWSTR ContactMessengers(void) const=0;
  295. virtual MTAPIRES ContactMessengers(LPCWSTR messengers)=0;
  296. //--- contact social networks
  297. virtual LPCWSTR ContactSocialNetworks(void) const=0;
  298. virtual MTAPIRES ContactSocialNetworks(LPCWSTR social_networks)=0;
  299. //--- ñontact last date
  300. virtual INT64 ContactLastDate(void) const=0;
  301. virtual MTAPIRES ContactLastDate(const INT64 date)=0;
  302. //--- address country
  303. virtual LPCWSTR AddressCountry(void) const=0;
  304. virtual MTAPIRES AddressCountry(LPCWSTR country)=0;
  305. //--- address postcode
  306. virtual LPCWSTR AddressPostcode(void) const=0;
  307. virtual MTAPIRES AddressPostcode(LPCWSTR postcode)=0;
  308. //--- address street
  309. virtual LPCWSTR AddressStreet(void) const=0;
  310. virtual MTAPIRES AddressStreet(LPCWSTR street)=0;
  311. //--- address state
  312. virtual LPCWSTR AddressState(void) const=0;
  313. virtual MTAPIRES AddressState(LPCWSTR state)=0;
  314. //--- address city
  315. virtual LPCWSTR AddressCity(void) const=0;
  316. virtual MTAPIRES AddressCity(LPCWSTR city)=0;
  317. //--- experience of FX
  318. virtual UINT ExperienceFX(void) const=0;
  319. virtual MTAPIRES ExperienceFX(const UINT experience)=0;
  320. //--- experience of CFD
  321. virtual UINT ExperienceCFD(void) const=0;
  322. virtual MTAPIRES ExperienceCFD(const UINT experience)=0;
  323. //--- experience of Futures
  324. virtual UINT ExperienceFutures(void) const=0;
  325. virtual MTAPIRES ExperienceFutures(const UINT experience)=0;
  326. //--- experience of Stocks
  327. virtual UINT ExperienceStocks(void) const=0;
  328. virtual MTAPIRES ExperienceStocks(const UINT experience)=0;
  329. //--- trading group
  330. virtual LPCWSTR TradingGroup(void) const=0;
  331. virtual MTAPIRES TradingGroup(LPCWSTR group)=0;
  332. //--- client origin
  333. virtual UINT ClientOrigin(void) const=0;
  334. virtual MTAPIRES ClientOrigin(const UINT origin)=0;
  335. //--- client origin login
  336. virtual UINT64 ClientOriginLogin(void) const=0;
  337. virtual MTAPIRES ClientOriginLogin(const UINT64 login)=0;
  338. //--- external ID
  339. virtual LPCWSTR ClientExternalID(void) const=0;
  340. virtual MTAPIRES ClientExternalID(LPCWSTR external_id)=0;
  341. };
  342. //+------------------------------------------------------------------+
  343. //| Client array interface |
  344. //+------------------------------------------------------------------+
  345. class IMTClientArray
  346. {
  347. public:
  348. //--- common methods
  349. virtual void Release(void)=0;
  350. virtual MTAPIRES Assign(const IMTClientArray* array)=0;
  351. virtual MTAPIRES Clear(void)=0;
  352. //--- add
  353. virtual MTAPIRES Add(IMTClient* client)=0;
  354. virtual MTAPIRES AddCopy(const IMTClient* client)=0;
  355. virtual MTAPIRES Add(IMTClientArray* array)=0;
  356. virtual MTAPIRES AddCopy(const IMTClientArray* array)=0;
  357. //--- delete & detach
  358. virtual MTAPIRES Delete(const UINT pos)=0;
  359. virtual IMTClient *Detach(const UINT pos)=0;
  360. //--- update
  361. virtual MTAPIRES Update(const UINT pos,IMTClient* client)=0;
  362. virtual MTAPIRES UpdateCopy(const UINT pos,const IMTClient* client)=0;
  363. virtual MTAPIRES Shift(const UINT pos,const int shift)=0;
  364. //--- data access
  365. virtual UINT Total(void) const=0;
  366. virtual IMTClient*Next(const UINT index) const=0;
  367. //--- sorting and search
  368. virtual MTAPIRES Sort(MTSortFunctionPtr sort_function)=0;
  369. virtual int Search(const void *key,MTSortFunctionPtr sort_function) const=0;
  370. virtual int SearchGreatOrEq(const void *key,MTSortFunctionPtr sort_function) const=0;
  371. virtual int SearchGreater(const void *key,MTSortFunctionPtr sort_function) const=0;
  372. virtual int SearchLessOrEq(const void *key,MTSortFunctionPtr sort_function) const=0;
  373. virtual int SearchLess(const void *key,MTSortFunctionPtr sort_function) const=0;
  374. virtual int SearchLeft(const void *key,MTSortFunctionPtr sort_function) const=0;
  375. virtual int SearchRight(const void *key,MTSortFunctionPtr sort_function) const=0;
  376. };
  377. //+------------------------------------------------------------------+
  378. //| Client records notification interface |
  379. //+------------------------------------------------------------------+
  380. class IMTClientSink
  381. {
  382. public:
  383. //--- events
  384. virtual void OnClientAdd(const IMTClient* /*client*/) { }
  385. virtual void OnClientUpdate(const IMTClient* /*client*/) { }
  386. virtual void OnClientDelete(const IMTClient* /*client*/) { }
  387. };
  388. //+------------------------------------------------------------------+