MT5APIBook.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. //+------------------------------------------------------------------+
  2. //| MetaTrader 5 API |
  3. //| Copyright 2000-2019, MetaQuotes Software Corp. |
  4. //| http://www.metaquotes.net |
  5. //+------------------------------------------------------------------+
  6. #pragma once
  7. //+------------------------------------------------------------------+
  8. //| Book item transaction structure |
  9. //+------------------------------------------------------------------+
  10. #pragma pack(push,1)
  11. struct MTBookItem
  12. {
  13. //--- book item type
  14. enum EnBookItem
  15. {
  16. ItemReset =0, // reset book item
  17. ItemSell =1, // sell item
  18. ItemBuy =2, // buy item
  19. ItemSellMarket =3, // sell item by market
  20. ItemBuyMarket =4 // buy item by market
  21. };
  22. UINT type; // EnBookItem
  23. double price; // deal price
  24. INT64 volume; // deal volume - only integer values
  25. INT64 volume_ext; // deal volume with extended accuracy - 8 digits
  26. UINT reserved[6]; // reserved
  27. };
  28. #pragma pack(pop)
  29. //+------------------------------------------------------------------+
  30. //| Book structure |
  31. //+------------------------------------------------------------------+
  32. #pragma pack(push,1)
  33. struct MTBook
  34. {
  35. //--- book flags
  36. enum EnBookFlags
  37. {
  38. FLAG_PRE_AUCTION=1, // pre-auction book state
  39. FLAG_SNAPSHOT =2, // snapshot of book
  40. //--- enumeration borders
  41. FLAG_NONE =0, // none
  42. FLAG_ALL =FLAG_PRE_AUCTION|FLAG_SNAPSHOT // all flags
  43. };
  44. wchar_t symbol[32]; // symbol
  45. MTBookItem items[32*4]; // book transactions
  46. UINT items_total; // book transactions count
  47. UINT64 flags; // flags
  48. INT64 datetime; // datetime
  49. INT64 datetime_msc; // datetime
  50. UINT reserved[58]; // reserved
  51. };
  52. #pragma pack(pop)
  53. //+------------------------------------------------------------------+
  54. //| Book difference structure type |
  55. //+------------------------------------------------------------------+
  56. typedef MTBook MTBookDiff;
  57. //+------------------------------------------------------------------+
  58. //| Book events notification interface |
  59. //+------------------------------------------------------------------+
  60. class IMTBookSink
  61. {
  62. public:
  63. virtual void OnBook(const MTBook& /*book*/) {}
  64. };
  65. //+------------------------------------------------------------------+