Package cloud.metaapi.sdk.meta_api
Class MemoryHistoryStorage
- java.lang.Object
-
- cloud.metaapi.sdk.clients.meta_api.SynchronizationListener
-
- cloud.metaapi.sdk.meta_api.HistoryStorage
-
- cloud.metaapi.sdk.meta_api.MemoryHistoryStorage
-
public class MemoryHistoryStorage extends HistoryStorage
History storage which stores MetaTrader history in RAM
-
-
Constructor Summary
Constructors Constructor Description MemoryHistoryStorage(String accountId)Constructs the in-memory history store instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<MetatraderDeal>getDeals()Returns all deals stored in history storageList<MetatraderOrder>getHistoryOrders()Returns all history orders stored in history storageCompletableFuture<IsoTime>getLastDealTime()Returns the time of the last history deal record stored in the history storageCompletableFuture<IsoTime>getLastHistoryOrderTime()Returns the time of the last history order record stored in the history storageCompletableFuture<Void>loadData()Loads history data from the file managerCompletableFuture<Void>loadDataFromDisk()Loads history data from the file manager.CompletableFuture<Void>onDealAdded(MetatraderDeal newDeal)Invoked when a new MetaTrader history deal is addedCompletableFuture<Void>onHistoryOrderAdded(MetatraderOrder historyOrder)Invoked when a new MetaTrader history order is addedvoidreset()Resets the storageCompletableFuture<Void>updateDiskStorage()Saves unsaved history items to disk storage.CompletableFuture<Void>updateStorage()Saves unsaved history items to storage-
Methods inherited from class cloud.metaapi.sdk.meta_api.HistoryStorage
isDealSynchronizationFinished, isOrderSynchronizationFinished, onConnected, onDealSynchronizationFinished, onOrderSynchronizationFinished
-
Methods inherited from class cloud.metaapi.sdk.clients.meta_api.SynchronizationListener
onAccountInformationUpdated, onBrokerConnectionStatusChanged, onDisconnected, onOrderCompleted, onOrderUpdated, onPositionRemoved, onPositionUpdated, onSymbolPriceUpdated, onSymbolSpecificationUpdated
-
-
-
-
Constructor Detail
-
MemoryHistoryStorage
public MemoryHistoryStorage(String accountId)
Constructs the in-memory history store instance- Parameters:
accountId- account id
-
-
Method Detail
-
getDeals
public List<MetatraderDeal> getDeals()
Description copied from class:HistoryStorageReturns all deals stored in history storage- Specified by:
getDealsin classHistoryStorage- Returns:
- all deals stored in history storage
-
getHistoryOrders
public List<MetatraderOrder> getHistoryOrders()
Description copied from class:HistoryStorageReturns all history orders stored in history storage- Specified by:
getHistoryOrdersin classHistoryStorage- Returns:
- all history orders stored in history storage
-
reset
public void reset()
Description copied from class:HistoryStorageResets the storage- Specified by:
resetin classHistoryStorage
-
loadData
public CompletableFuture<Void> loadData()
Description copied from class:HistoryStorageLoads history data from the file manager- Specified by:
loadDatain classHistoryStorage- Returns:
- completable future which resolves when the history is loaded
-
loadDataFromDisk
public CompletableFuture<Void> loadDataFromDisk()
Loads history data from the file manager. This method is an alias ofloadData().- Returns:
- completable future which resolves when the history is loaded
-
updateStorage
public CompletableFuture<Void> updateStorage()
Description copied from class:HistoryStorageSaves unsaved history items to storage- Specified by:
updateStoragein classHistoryStorage- Returns:
- completable future which resolves when storage is updated
-
updateDiskStorage
public CompletableFuture<Void> updateDiskStorage()
Saves unsaved history items to disk storage. This method is an alias ofupdateStorage().- Returns:
- completable future which resolves when disk storage is updated
-
getLastHistoryOrderTime
public CompletableFuture<IsoTime> getLastHistoryOrderTime()
Description copied from class:HistoryStorageReturns the time of the last history order record stored in the history storage- Specified by:
getLastHistoryOrderTimein classHistoryStorage
-
getLastDealTime
public CompletableFuture<IsoTime> getLastDealTime()
Description copied from class:HistoryStorageReturns the time of the last history deal record stored in the history storage- Specified by:
getLastDealTimein classHistoryStorage
-
onHistoryOrderAdded
public CompletableFuture<Void> onHistoryOrderAdded(MetatraderOrder historyOrder)
Description copied from class:SynchronizationListenerInvoked when a new MetaTrader history order is added- Specified by:
onHistoryOrderAddedin classHistoryStorage- Parameters:
historyOrder- new MetaTrader history order- Returns:
- completable future which resolves when the asynchronous event is processed
-
onDealAdded
public CompletableFuture<Void> onDealAdded(MetatraderDeal newDeal)
Description copied from class:SynchronizationListenerInvoked when a new MetaTrader history deal is added- Specified by:
onDealAddedin classHistoryStorage- Parameters:
newDeal- new MetaTrader history deal- Returns:
- completable future which resolves when the asynchronous event is processed
-
-