public interface IClient
Main entry point for the connection to the server
| Method Summary | |
|---|---|
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<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)
Returns IClientGUI for specified IChart. |
INewsFilter |
getNewsFilter(INewsFilter.NewsSource newsSource)
Returns news filter for the source |
java.util.Map<java.lang.Long,IStrategy> |
getStartedStrategies()
Returns map with ids mapped to associated strategies |
java.util.Set<Instrument> |
getSubscribedInstruments()
Returns subscribed instruments |
boolean |
isConnected()
Returns true if client is authenticated authorized and transport is in connected state |
IStrategy |
loadStrategy(java.io.File strategyBinaryFile)
Loads strategy from jfx file |
IChart |
openChart(IFeedDescriptor feedDescriptor)
Opens new chart with specified in IFeedDescriptor parameters. |
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 |
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 |
setSystemListener(ISystemListener systemListener)
Sets the listener, that will receive notifications about connects disconnects and strategies starts and stops |
void |
setSubscribedInstruments(java.util.Set<Instrument> instruments)
Subscribes to the specified instruments set. |
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 |
stopStrategy(long processId)
Stops the strategy with the specified id |
| Method Detail |
|---|
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 - password
JFAuthenticationException - authentication error, incorrect username or password,
IP address unrecognized in case of LIVE systems
JFVersionException - version is blocked on the server, update your libraries
java.lang.Exception - all kinds of errors that resulted in exception
void 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) call
JFAuthenticationException - authentication error, incorrect username or password,
IP address unrecognized in case of LIVE systems
JFVersionException - version is blocked on the server, update your libraries
java.lang.Exception - all kinds of errors that resulted in exception
java.awt.image.BufferedImage getCaptchaImage(java.lang.String jnlp)
throws java.lang.Exception
jnlp - address of jnlp file, that is used to launch platform
java.lang.Exception - if request for captcha failedvoid reconnect()
ISystemListener interface
void disconnect()
boolean isConnected()
long startStrategy(IStrategy strategy)
throws java.lang.IllegalStateException,
java.lang.NullPointerException
strategy - strategy to run
java.lang.IllegalStateException - if not connected
java.lang.NullPointerException - if one of the parameters is null
long 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 exception
java.lang.IllegalStateException - if not connected
java.lang.NullPointerException - if one of the parameters is null
IStrategy loadStrategy(java.io.File strategyBinaryFile)
throws java.lang.Exception
strategyBinaryFile - jfx file
java.lang.Exception - if loading failedvoid stopStrategy(long processId)
processId - id of the strategyjava.util.Map<java.lang.Long,IStrategy> getStartedStrategies()
void setSystemListener(ISystemListener systemListener)
systemListener - listenervoid addNewsFilter(INewsFilter newsFilter)
newsFilter - news filterINewsFilter getNewsFilter(INewsFilter.NewsSource newsSource)
newsSource - news source
INewsFilter removeNewsFilter(INewsFilter.NewsSource newsSource)
newsSource - news source
void setSubscribedInstruments(java.util.Set<Instrument> instruments)
instruments - set of the instrumentsjava.util.Set<Instrument> getSubscribedInstruments()
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"
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 saved
void compileStrategy(java.lang.String srcJavaFile,
boolean obfuscate)
srcJavaFile - .java source file to be compiledobfuscate - if true, the strategy will be obfuscated
java.lang.IllegalStateException - if not connectedvoid addClientGUIListener(IClientGUIListener clientGuiListener)
IClientGUIListener which is "interested" in open / close charts from strategy
clientGuiListener - IClientGUIListenervoid removeClientGUIListener(IClientGUIListener clientGuiListener)
IClientGUIListener
clientGuiListener - IClientGUIListenerIChart openChart(IFeedDescriptor feedDescriptor)
IFeedDescriptor parameters.
feedDescriptor -
java.lang.IllegalArgumentException - when feedDescriptor not formed wellvoid closeChart(IChart chart)
chart - IClientGUI 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()