public class MetatraderAccount extends Object
| Constructor and Description |
|---|
MetatraderAccount(MetatraderAccountDto data,
MetatraderAccountClient metatraderAccountClient,
MetaApiWebsocketClient metaApiWebsocketClient,
ConnectionRegistry connectionRegistry)
Constructs a MetaTrader account entity
|
| Modifier and Type | Method and Description |
|---|---|
CompletableFuture<MetaApiConnection> |
connect()
Connects to MetaApi with default history storage.
|
CompletableFuture<MetaApiConnection> |
connect(HistoryStorage historyStorage)
Connects to MetaApi.
|
CompletableFuture<MetaApiConnection> |
connect(HistoryStorage historyStorage,
IsoTime historyStartTime)
Connects to MetaApi.
|
CompletableFuture<Void> |
deploy()
Schedules account for deployment.
|
String |
getAccessToken()
Returns authorization access token to be used for accessing single account data.
|
String |
getApplication()
Returns application name to connect the account to.
|
MetatraderAccountDto.ConnectionStatus |
getConnectionStatus()
Returns terminal and broker connection status
|
String |
getId()
Returns account id
|
String |
getLogin()
Returns account login
|
int |
getMagic()
Returns MetaTrader magic to place trades using
|
String |
getName()
Returns account name
|
String |
getProvisioningProfileId()
Returns id of the account's provisioning profile
|
String |
getServer()
Returns MetaTrader server which hosts the account
|
MetatraderAccountDto.DeploymentState |
getState()
Returns account deployment state
|
String |
getType()
Returns account type.
|
boolean |
isManualTrades()
Returns flag indicating if trades should be placed as manual trades on this account
|
CompletableFuture<Void> |
redeploy()
Schedules account for redeployment.
|
CompletableFuture<Void> |
reload()
Reloads MetaTrader account from API
|
CompletableFuture<Void> |
remove()
Removes MetaTrader account.
|
CompletableFuture<Void> |
undeploy()
Schedules account for undeployment.
|
CompletableFuture<Void> |
update(MetatraderAccountUpdateDto account)
Updates MetaTrader account data
|
CompletableFuture<Void> |
waitConnected()
Waits until API server has connected to the terminal and terminal has connected to the broker.
|
CompletableFuture<Void> |
waitConnected(Integer timeoutInSeconds,
Integer intervalInMilliseconds)
Waits until API server has connected to the terminal and terminal has connected to the broker.
|
CompletableFuture<Void> |
waitDeployed(Integer timeoutInSeconds,
Integer intervalInMilliseconds)
Waits until API server has finished deployment and account reached the DEPLOYED state.
|
CompletableFuture<Void> |
waitRemoved(Integer timeoutInSeconds,
Integer intervalInMilliseconds)
Waits until account has been deleted.
|
CompletableFuture<Void> |
waitUndeployed(Integer timeoutInSeconds,
Integer intervalInMilliseconds)
Waits until API server has finished undeployment and account reached the UNDEPLOYED state.
|
public MetatraderAccount(MetatraderAccountDto data, MetatraderAccountClient metatraderAccountClient, MetaApiWebsocketClient metaApiWebsocketClient, ConnectionRegistry connectionRegistry)
data - MetaTrader account datametatraderAccountClient - MetaTrader account REST API clientmetaApiWebsocketClient - MetaApi websocket clientconnectionRegistry - metatrader account connection registrypublic String getId()
public String getName()
public String getType()
public String getLogin()
public String getServer()
public String getProvisioningProfileId()
public String getApplication()
public int getMagic()
public MetatraderAccountDto.DeploymentState getState()
public MetatraderAccountDto.ConnectionStatus getConnectionStatus()
public String getAccessToken()
public boolean isManualTrades()
public CompletableFuture<Void> reload()
public CompletableFuture<Void> remove()
public CompletableFuture<Void> deploy()
public CompletableFuture<Void> undeploy()
public CompletableFuture<Void> redeploy()
public CompletableFuture<Void> waitDeployed(Integer timeoutInSeconds, Integer intervalInMilliseconds)
TimeoutException if account have not reached the DEPLOYED state
withing timeout allowed.timeoutInSeconds - optional wait timeout in seconds, default is 5mintervalInMilliseconds - optional interval between account reloads while waiting for a change, default is 1spublic CompletableFuture<Void> waitUndeployed(Integer timeoutInSeconds, Integer intervalInMilliseconds)
TimeoutException if account have not reached the UNDEPLOYED state
withing timeout allowed.timeoutInSeconds - optional wait timeout in seconds, default is 5mintervalInMilliseconds - optional interval between account reloads while waiting for a change, default is 1spublic CompletableFuture<Void> waitRemoved(Integer timeoutInSeconds, Integer intervalInMilliseconds)
TimeoutException
if account was not deleted withing timeout allowed.timeoutInSeconds - optional wait timeout in seconds, default is 5mintervalInMilliseconds - optional interval between account reloads while waiting for a change, default is 1spublic CompletableFuture<Void> waitConnected()
TimeoutException if account have not connected to the broker
withing timeout allowed. Wait timeout in seconds is 5m and interval between account reloads while
waiting for a change is 1s.public CompletableFuture<Void> waitConnected(Integer timeoutInSeconds, Integer intervalInMilliseconds)
TimeoutException if account have not connected to the broker
withing timeout allowed.timeoutInSeconds - optional wait timeout in seconds, default is 5mintervalInMilliseconds - optional interval between account reloads while waiting for a change, default is 1spublic CompletableFuture<MetaApiConnection> connect()
public CompletableFuture<MetaApiConnection> connect(HistoryStorage historyStorage)
historyStorage - optional history storage, or nullpublic CompletableFuture<MetaApiConnection> connect(HistoryStorage historyStorage, IsoTime historyStartTime)
historyStorage - optional history storage, or nullhistoryStartTime - history start time, or null. Used for testspublic CompletableFuture<Void> update(MetatraderAccountUpdateDto account)
account - MetaTrader account updateCopyright © 2020. All rights reserved.