public interface IClient
| Modifier and Type | Method and Description |
|---|---|
void |
addClientGUIListener(IClientGUIListener clientGuiListener)
Register a
IClientGUIListener which is "interested" in open / close charts from strategy |
void |
addNewsFilter(INewsFilter newsFilter)
Adds news filter
|
void |
closeChart(IChart chart)
Close specified chart.
|
void |
compileStrategy(String srcJavaFile,
boolean obfuscate)
Compile .java strategy file to .jfx file.
|
void |
connect(String jnlp,
String username,
String password)
Authenticates and connects to dukascopy servers
|
void |
connect(String jnlp,
String username,
String password,
String pin)
Authenticates and connects to dukascopy servers
|
void |
disconnect()
Stops all running strategies and disconnect from dukascopy server.
|
Set<Instrument> |
getAvailableInstruments()
Returns a set of operable for the current user instruments.
|
BufferedImage |
getCaptchaImage(String jnlp)
Returns the image that can be provided to the user to generate correct pin code
|
IClientGUI |
getClientGUI(IChart chart)
|
INewsFilter |
getNewsFilter(INewsFilter.NewsSource newsSource)
Returns news filter for the source
|
IPreferences |
getPreferences()
Returns global preference holder for JForex-SDK
|
IRemoteStrategyManager |
getRemoteStrategyManager()
Returns a manager for remote strategy running, stopping and monitoring
|
Map<UUID,Plugin> |
getRunningPlugins()
Returns map with ids mapped to associated strategies
|
Map<Long,IStrategy> |
getStartedStrategies()
Returns map with ids mapped to associated strategies.
|
Set<Instrument> |
getSubscribedInstruments()
Returns subscribed instruments
|
boolean |
isConnected()
Returns true if client is authenticated authorized and transport is in connected state
|
IStrategy |
loadStrategy(File strategyBinaryFile)
Loads strategy from jfx file
|
IChart |
openChart(IFeedDescriptor feedDescriptor)
Opens new chart with specified in
IFeedDescriptor parameters. |
File |
packPluginToJfx(File file) |
File |
packToJfx(File file)
Packs .jar a strategy, indicator or plugin file to .jfx file.
|
void |
reconnect()
Tries to reconnect transport without reauthenticating.
|
void |
removeClientGUIListener(IClientGUIListener clientGuiListener)
Unregister a
IClientGUIListener |
INewsFilter |
removeNewsFilter(INewsFilter.NewsSource newsSource)
Removes news filter, resetting it to the default value
|
UUID |
runPlugin(Plugin plugin,
IStrategyExceptionHandler exceptionHandler)
Starts the plugin
|
UUID |
runPlugin(Plugin plugin,
IStrategyExceptionHandler exceptionHandler,
PluginGuiListener pluginGuiListener)
Starts the strategy
|
void |
setCacheDirectory(File cacheDirectory)
Sets the location of the cache files.
|
void |
setErr(PrintStream err)
Sets stream that will be passed to the strategy through IConsole.
|
void |
setOut(PrintStream out)
Sets stream that will be passed to the strategy through IConsole.
|
void |
setPreferences(IPreferences preferences)
Sets global preferences for JForex-SDK
Consider hiding the position labels and the closed positions from charts (needs to be called after a successful connection):
|
void |
setSubscribedInstruments(Set<Instrument> instruments)
Subscribes to the specified instruments set.
|
void |
setSystemListener(ISystemListener systemListener)
Sets the listener, that will receive notifications about connects disconnects and strategies starts and stops.
|
long |
startStrategy(IStrategy strategy)
Starts the strategy with default exception handler that will stop strategy if it trows exception
|
long |
startStrategy(IStrategy strategy,
IStrategyExceptionHandler exceptionHandler)
Starts the strategy
|
void |
stopPlugin(UUID processId)
Stops the strategy with the specified id
|
void |
stopStrategy(long processId)
Stops the strategy with the specified id
|
void connect(String jnlp, String username, String password) throws JFAuthenticationException, JFVersionException, Exception
jnlp - address of jnlp file, that is used to launch platformusername - user namepassword - passwordJFAuthenticationException - authentication error, incorrect username or password,
IP address unrecognized in case of LIVE systemsJFVersionException - version is blocked on the server, update your librariesException - all kinds of errors that resulted in exceptionvoid connect(String jnlp, String username, String password, String pin) throws JFAuthenticationException, JFVersionException, Exception
jnlp - address of jnlp file, that is used to launch platformusername - user namepassword - passwordpin - pin code generated with the captcha from the last getCaptchaImage(java.lang.String) callJFAuthenticationException - authentication error, incorrect username or password,
IP address unrecognized in case of LIVE systemsJFVersionException - version is blocked on the server, update your librariesException - all kinds of errors that resulted in exceptionBufferedImage getCaptchaImage(String jnlp) throws Exception
jnlp - address of jnlp file, that is used to launch platformException - if request for captcha failedvoid reconnect()
ISystemListener interfacevoid disconnect()
boolean isConnected()
long startStrategy(IStrategy strategy) throws IllegalStateException, NullPointerException
strategy - strategy to runIllegalStateException - if not connectedNullPointerException - if one of the parameters is nulllong startStrategy(IStrategy strategy, IStrategyExceptionHandler exceptionHandler) throws IllegalStateException, NullPointerException
strategy - strategy to runexceptionHandler - if not null then passed exception handler will be called when strategy throws exceptionIllegalStateException - if not connectedNullPointerException - if one of the parameters is nullUUID runPlugin(Plugin plugin, IStrategyExceptionHandler exceptionHandler) throws IllegalStateException, NullPointerException
plugin - plugin to runexceptionHandler - if not null then passed exception handler will be called when strategy throws exceptionIllegalStateException - if not connectedNullPointerException - if one of the parameters is nullUUID runPlugin(Plugin plugin, IStrategyExceptionHandler exceptionHandler, PluginGuiListener pluginGuiListener) throws IllegalStateException, NullPointerException
plugin - plugin to runexceptionHandler - if not null then passed exception handler will be called when strategy throws exceptionpluginGuiListener - listener for plugin gui eventsIllegalStateException - if not connectedNullPointerException - if one of the parameters is nullvoid stopPlugin(UUID processId)
processId - id of the strategyIStrategy loadStrategy(File strategyBinaryFile) throws Exception
strategyBinaryFile - jfx fileException - if loading failedvoid stopStrategy(long processId)
processId - id of the strategyMap<Long,IStrategy> getStartedStrategies()
Map<UUID,Plugin> getRunningPlugins()
void setSystemListener(ISystemListener systemListener)
systemListener - listenervoid addNewsFilter(INewsFilter newsFilter)
newsFilter - news filterINewsFilter getNewsFilter(INewsFilter.NewsSource newsSource)
newsSource - news sourceINewsFilter removeNewsFilter(INewsFilter.NewsSource newsSource)
newsSource - news sourcevoid setSubscribedInstruments(Set<Instrument> instruments)
instruments - set of the instrumentsSet<Instrument> getSubscribedInstruments()
void setOut(PrintStream out)
out - streamvoid setErr(PrintStream err)
err - streamvoid setCacheDirectory(File cacheDirectory)
System.getProperty("java.io.tmpdir") + "/.cache"
The method should get called before the call of connect(String, String, String).
WARNING: JForex might delete all folder's content if folder already existed AND was not created by this method call.
cacheDirectory - directory where cache files should be savedvoid compileStrategy(String srcJavaFile, boolean obfuscate)
srcJavaFile - .java source file to be compiledobfuscate - if true, the strategy will be obfuscatedIllegalStateException - if not connectedFile packPluginToJfx(File file)
file - .jar source file to be packedIllegalStateException - if not connectedpackToJfx(File)File packToJfx(File file)
jfMainClass: mypackage.MyStrategy
file - .jar source file to be packedIllegalStateException - if not connectedvoid addClientGUIListener(IClientGUIListener clientGuiListener)
IClientGUIListener which is "interested" in open / close charts from strategyclientGuiListener - IClientGUIListenervoid removeClientGUIListener(IClientGUIListener clientGuiListener)
IClientGUIListenerclientGuiListener - IClientGUIListenerIChart openChart(IFeedDescriptor feedDescriptor)
IFeedDescriptor parameters.feedDescriptor - Feed descriptor for chart to openIllegalArgumentException - when feedDescriptor not formed wellvoid closeChart(IChart chart)
chart - Chart to closeIClientGUI getClientGUI(IChart chart)
IClientGUI for specified IChart.chart - IChartIClientGUI for specified IChart, or null if it's not Standalone JForex API environment.Set<Instrument> getAvailableInstruments()
IPreferences getPreferences()
void setPreferences(IPreferences preferences)
IPreferences pref = client
.getPreferences().chart().orders()
.entryOrders(true)
.preferences().chart().positions()
.positionExternalIdLabels(false)
.closedPositions(false)
.openPositions(true)
.preferences();
client.setPreferences(pref);
IRemoteStrategyManager getRemoteStrategyManager()
Copyright © 2016. All rights reserved.