public class ServiceProvider extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
ServiceProvider.MetaApiConnectionProvider
Interface for creating
MetaApiConnection. |
| Constructor and Description |
|---|
ServiceProvider() |
| Modifier and Type | Method and Description |
|---|---|
static HistoryFileManager |
createHistoryFileManager(String accountId,
String application,
HistoryStorage storage)
Constructs history file manager with its corresponding constructor or returns a mock if it is set.
|
static MetaApiConnection |
createMetaApiConnection(MetaApiWebsocketClient websocketClient,
MetatraderAccount account,
HistoryStorage historyStorage,
ConnectionRegistry connectionRegistry,
IsoTime historyStartTime)
Constructs metaapi connection with its corresponding constructor or returns a mock if it is set.
|
static void |
setHistoryFileManagerMock(HistoryFileManager mock)
Sets history file manager mock that will be created by this provider.
|
static void |
setMetApiConnectionMock(MetaApiConnection mock)
Sets metaapi connection mock that will be created by this provider.
|
static void |
setMetApiConnectionMock(ServiceProvider.MetaApiConnectionProvider mockProvider)
Sets metaapi connection provider that will be used for creating the mock.
|
public static HistoryFileManager createHistoryFileManager(String accountId, String application, HistoryStorage storage)
accountId - account idapplication - MetaApi application idstorage - storagesetHistoryFileManagerMock(HistoryFileManager)public static void setHistoryFileManagerMock(HistoryFileManager mock)
null is set, the mock is removed and the object will be created as normal.mock - mocked history file manager or nullpublic static MetaApiConnection createMetaApiConnection(MetaApiWebsocketClient websocketClient, MetatraderAccount account, HistoryStorage historyStorage, ConnectionRegistry connectionRegistry, IsoTime historyStartTime)
websocketClient - MetaApi websocket clientaccount - MetaTrader account to connect tohistoryStorage - optional local terminal history storage. Use for accounts in user synchronization mode.
By default an instance of MemoryHistoryStorage will be used.connectionRegistry - metatrader account connection registryhistoryStartTime - history start sync time, or nullsetHistoryFileManagerMock(HistoryFileManager)public static void setMetApiConnectionMock(MetaApiConnection mock)
null is set, the mock is removed and the object will be created as normal.mock - mocked metaapi connection or nullpublic static void setMetApiConnectionMock(ServiceProvider.MetaApiConnectionProvider mockProvider)
null is set, the mock provider is removed and the object will be created as normal.mockProvider - mocked metaapi connection or nullCopyright © 2020. All rights reserved.