Package cloud.metaapi.sdk.meta_api
Class HistoryStorage
- java.lang.Object
-
- cloud.metaapi.sdk.clients.meta_api.SynchronizationListener
-
- cloud.metaapi.sdk.meta_api.HistoryStorage
-
- Direct Known Subclasses:
MemoryHistoryStorage
public abstract class HistoryStorage extends SynchronizationListener
Abstract class which defines MetaTrader history storage interface.
-
-
Constructor Summary
Constructors Constructor Description HistoryStorage()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract List<MetatraderDeal>getDeals()Returns all deals stored in history storageabstract List<MetatraderOrder>getHistoryOrders()Returns all history orders stored in history storageabstract CompletableFuture<IsoTime>getLastDealTime()Returns the time of the last history deal record stored in the history storageabstract CompletableFuture<IsoTime>getLastHistoryOrderTime()Returns the time of the last history order record stored in the history storagebooleanisDealSynchronizationFinished()Returns flag indicating whether deal history synchronization have finishedbooleanisOrderSynchronizationFinished()Returns flag indicating whether order history synchronization have finishedabstract CompletableFuture<Void>loadData()Loads history data from the file managerCompletableFuture<Void>onConnected()Invoked when connection to MetaTrader terminal establishedabstract CompletableFuture<Void>onDealAdded(MetatraderDeal deal)Invoked when a new MetaTrader history deal is addedCompletableFuture<Void>onDealSynchronizationFinished(String synchronizationId)Invoked when a synchronization of history deals on a MetaTrader account have finishedabstract CompletableFuture<Void>onHistoryOrderAdded(MetatraderOrder historyOrder)Invoked when a new MetaTrader history order is addedCompletableFuture<Void>onOrderSynchronizationFinished(String synchronizationId)Invoked when a synchronization of history orders on a MetaTrader account have finishedabstract voidreset()Resets the storageabstract CompletableFuture<Void>updateStorage()Saves unsaved history items to storage-
Methods inherited from class cloud.metaapi.sdk.clients.meta_api.SynchronizationListener
onAccountInformationUpdated, onBrokerConnectionStatusChanged, onDisconnected, onOrderCompleted, onOrderUpdated, onPositionRemoved, onPositionUpdated, onSymbolPriceUpdated, onSymbolSpecificationUpdated
-
-
-
-
Method Detail
-
getDeals
public abstract List<MetatraderDeal> getDeals()
Returns all deals stored in history storage- Returns:
- all deals stored in history storage
-
getHistoryOrders
public abstract List<MetatraderOrder> getHistoryOrders()
Returns all history orders stored in history storage- Returns:
- all history orders stored in history storage
-
reset
public abstract void reset()
Resets the storage
-
loadData
public abstract CompletableFuture<Void> loadData()
Loads history data from the file manager- Returns:
- completable future which resolves when the history is loaded
-
updateStorage
public abstract CompletableFuture<Void> updateStorage()
Saves unsaved history items to storage- Returns:
- completable future which resolves when storage is updated
-
isOrderSynchronizationFinished
public boolean isOrderSynchronizationFinished()
Returns flag indicating whether order history synchronization have finished- Returns:
- flag indicating whether order history synchronization have finished
-
isDealSynchronizationFinished
public boolean isDealSynchronizationFinished()
Returns flag indicating whether deal history synchronization have finished- Returns:
- flag indicating whether deal history synchronization have finished
-
getLastHistoryOrderTime
public abstract CompletableFuture<IsoTime> getLastHistoryOrderTime()
Returns the time of the last history order record stored in the history storage
-
getLastDealTime
public abstract CompletableFuture<IsoTime> getLastDealTime()
Returns the time of the last history deal record stored in the history storage
-
onHistoryOrderAdded
public abstract CompletableFuture<Void> onHistoryOrderAdded(MetatraderOrder historyOrder)
Description copied from class:SynchronizationListenerInvoked when a new MetaTrader history order is added- Overrides:
onHistoryOrderAddedin classSynchronizationListener- Parameters:
historyOrder- new MetaTrader history order- Returns:
- completable future which resolves when the asynchronous event is processed
-
onDealAdded
public abstract CompletableFuture<Void> onDealAdded(MetatraderDeal deal)
Description copied from class:SynchronizationListenerInvoked when a new MetaTrader history deal is added- Overrides:
onDealAddedin classSynchronizationListener- Parameters:
deal- new MetaTrader history deal- Returns:
- completable future which resolves when the asynchronous event is processed
-
onDealSynchronizationFinished
public CompletableFuture<Void> onDealSynchronizationFinished(String synchronizationId)
Description copied from class:SynchronizationListenerInvoked when a synchronization of history deals on a MetaTrader account have finished- Overrides:
onDealSynchronizationFinishedin classSynchronizationListener- Parameters:
synchronizationId- synchronization request id- Returns:
- completable future which resolves when the asynchronous event is processed
-
onOrderSynchronizationFinished
public CompletableFuture<Void> onOrderSynchronizationFinished(String synchronizationId)
Description copied from class:SynchronizationListenerInvoked when a synchronization of history orders on a MetaTrader account have finished- Overrides:
onOrderSynchronizationFinishedin classSynchronizationListener- Parameters:
synchronizationId- synchronization request id- Returns:
- completable future which resolves when the asynchronous event is processed
-
onConnected
public CompletableFuture<Void> onConnected()
Description copied from class:SynchronizationListenerInvoked when connection to MetaTrader terminal established- Overrides:
onConnectedin classSynchronizationListener- Returns:
- completable future which resolves when the asynchronous event is processed
-
-