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(java.lang.String srcJavaFile,
boolean obfuscate)
Compile .java strategy file to .jfx file.
|
void |
connect(java.lang.String jnlp,
java.lang.String username,
java.lang.String password)
Authenticates and connects to dukascopy servers
|
void |
connect(java.lang.String jnlp,
java.lang.String username,
java.lang.String password,
java.lang.String pin)
Authenticates and connects to dukascopy servers
|
void |
disconnect()
Stops all running strategies and disconnect from dukascopy server.
|
java.util.Set<IFinancialInstrument> |
getAvailableFinancialInstruments()
Deprecated.
|
java.util.Set<Instrument> |
getAvailableInstruments()
Returns a set of operable for the current user instruments.
|
java.awt.image.BufferedImage |
getCaptchaImage(java.lang.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
|
java.util.Map<java.util.UUID,Plugin> |
getRunningPlugins()
Returns map with ids mapped to associated strategies
|
java.util.Map<java.lang.Long,IStrategy> |
getStartedStrategies()
Returns map with ids mapped to associated strategies.
|
java.util.Set<IFinancialInstrument> |
getSubscribedFinancialInstruments()
Deprecated.
|
java.util.Set<Instrument> |
getSubscribedInstruments()
Returns subscribed instruments
|
boolean |
isConnected()
Returns true if client is authenticated authorized and transport is in connected state
|
boolean |
isReconnectAllowed()
Returns true if reconnect is allowed.
|
IStrategy |
loadStrategy(java.io.File strategyBinaryFile)
Loads strategy from jfx file
|
IChart |
openChart(java.io.File template)
Opens new chart from specified .tmpl file
|
IChart |
openChart(IFeedDescriptor feedDescriptor)
Opens new chart with specified in
IFeedDescriptor parameters. |
IChart |
openChart(IFeedInfo feedInfo)
Deprecated.
|
java.io.File |
packPluginToJfx(java.io.File file) |
java.io.File |
packToJfx(java.io.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
|
java.util.UUID |
runPlugin(Plugin plugin,
IStrategyExceptionHandler exceptionHandler)
Starts the plugin
|
java.util.UUID |
runPlugin(Plugin plugin,
IStrategyExceptionHandler exceptionHandler,
PluginGuiListener pluginGuiListener)
Starts the strategy
|
void |
saveChart(IChart chart,
java.io.File template)
Saves chart to specified .tmpl file
|
void |
setCacheDirectory(java.io.File cacheDirectory)
Sets the location of the cache files.
|
void |
setErr(java.io.PrintStream err)
Sets stream that will be passed to the strategy through IConsole.
|
void |
setOut(java.io.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 |
setSubscribedFinancialInstruments(java.util.Set<IFinancialInstrument> financialInstruments)
Deprecated.
|
void |
setSubscribedInstruments(java.util.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(java.util.UUID processId)
Stops the strategy with the specified id
|
void |
stopStrategy(long processId)
Stops the strategy with the specified id
|
void |
unsubscribeInstruments(java.util.Set<Instrument> instruments)
Unsubscribes from instruments specified in instruments set.
|
void connect(java.lang.String jnlp, java.lang.String username, java.lang.String password) throws JFAuthenticationException, JFVersionException, java.lang.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 librariesjava.lang.Exception
- all kinds of errors that resulted in exceptionvoid connect(java.lang.String jnlp, java.lang.String username, java.lang.String password, java.lang.String pin) throws JFAuthenticationException, JFVersionException, java.lang.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 librariesjava.lang.Exception
- all kinds of errors that resulted in exceptionjava.awt.image.BufferedImage getCaptchaImage(java.lang.String jnlp) throws java.lang.Exception
jnlp
- address of jnlp file, that is used to launch platformjava.lang.Exception
- if request for captcha failedvoid reconnect()
ISystemListener
interfaceboolean isReconnectAllowed()
void disconnect()
boolean isConnected()
long startStrategy(IStrategy strategy) throws java.lang.IllegalStateException, java.lang.NullPointerException
strategy
- strategy to runjava.lang.IllegalStateException
- if not connectedjava.lang.NullPointerException
- if one of the parameters is nulllong startStrategy(IStrategy strategy, IStrategyExceptionHandler exceptionHandler) throws java.lang.IllegalStateException, java.lang.NullPointerException
strategy
- strategy to runexceptionHandler
- if not null then passed exception handler will be called when strategy throws exceptionjava.lang.IllegalStateException
- if not connectedjava.lang.NullPointerException
- if one of the parameters is nulljava.util.UUID runPlugin(Plugin plugin, IStrategyExceptionHandler exceptionHandler) throws java.lang.IllegalStateException, java.lang.NullPointerException
plugin
- plugin to runexceptionHandler
- if not null then passed exception handler will be called when strategy throws exceptionjava.lang.IllegalStateException
- if not connectedjava.lang.NullPointerException
- if one of the parameters is nulljava.util.UUID runPlugin(Plugin plugin, IStrategyExceptionHandler exceptionHandler, PluginGuiListener pluginGuiListener) throws java.lang.IllegalStateException, java.lang.NullPointerException
plugin
- plugin to runexceptionHandler
- if not null then passed exception handler will be called when strategy throws exceptionpluginGuiListener
- listener for plugin gui eventsjava.lang.IllegalStateException
- if not connectedjava.lang.NullPointerException
- if one of the parameters is nullvoid stopPlugin(java.util.UUID processId)
processId
- id of the strategyIStrategy loadStrategy(java.io.File strategyBinaryFile) throws java.lang.Exception
strategyBinaryFile
- jfx filejava.lang.Exception
- if loading failedvoid stopStrategy(long processId)
processId
- id of the strategyjava.util.Map<java.lang.Long,IStrategy> getStartedStrategies()
java.util.Map<java.util.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(java.util.Set<Instrument> instruments)
instruments
- set of the instrumentsvoid unsubscribeInstruments(java.util.Set<Instrument> instruments)
instruments
- set of the instruments@Deprecated void setSubscribedFinancialInstruments(java.util.Set<IFinancialInstrument> financialInstruments)
financialInstruments
- set of the instrumentsjava.util.Set<Instrument> getSubscribedInstruments()
@Deprecated java.util.Set<IFinancialInstrument> getSubscribedFinancialInstruments()
void setOut(java.io.PrintStream out)
out
- streamvoid setErr(java.io.PrintStream err)
err
- streamvoid setCacheDirectory(java.io.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(java.lang.String srcJavaFile, boolean obfuscate)
srcJavaFile
- .java source file to be compiledobfuscate
- if true, the strategy will be obfuscatedjava.lang.IllegalStateException
- if not connectedjava.io.File packPluginToJfx(java.io.File file)
file
- .jar source file to be packedjava.lang.IllegalStateException
- if not connectedpackToJfx(File)
java.io.File packToJfx(java.io.File file)
jfMainClass: mypackage.MyStrategy
file
- .jar source file to be packedjava.lang.IllegalStateException
- if not connectedvoid addClientGUIListener(IClientGUIListener clientGuiListener)
IClientGUIListener
which is "interested" in open / close charts from strategyclientGuiListener
- IClientGUIListener
void removeClientGUIListener(IClientGUIListener clientGuiListener)
IClientGUIListener
clientGuiListener
- IClientGUIListener
IChart openChart(IFeedDescriptor feedDescriptor)
IFeedDescriptor
parameters.feedDescriptor
- Feed descriptor for chart to openjava.lang.IllegalArgumentException
- when feedDescriptor not formed well@Deprecated IChart openChart(IFeedInfo feedInfo)
IFeedInfo
parameters.feedInfo
- Feed info for chart to openjava.lang.IllegalArgumentException
- when feedDescriptor not formed wellIChart openChart(java.io.File template)
template
- file to openjava.lang.IllegalArgumentException
- when file is not found or validvoid saveChart(IChart chart, java.io.File template)
chart
- existing charttemplate
- file to savevoid closeChart(IChart chart)
chart
- Chart to closeIClientGUI getClientGUI(IChart chart)
IClientGUI
for specified IChart
.chart
- IChart
IClientGUI
for specified IChart
, or null
if it's not Standalone JForex API environment.java.util.Set<Instrument> getAvailableInstruments()
@Deprecated java.util.Set<IFinancialInstrument> getAvailableFinancialInstruments()
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);
preferences
- preferencesIRemoteStrategyManager getRemoteStrategyManager()
Copyright © 2024. All rights reserved.