Work with charts
チャートとしての機能
There are two ways how one can open a chart:
チャートを開くことができる方法が2つある:
IClient.openChart is used to open a chart without running a strategy.
IClient.openChartはストラテジを実行せずチャートを開くのに使われる。
IClient.addClientGUIListener adds a listener for the program to handle IContext.openChart and IContext.closeChart events.
IClient.addClientGUIListenerはプログラムにリスナを追加し、IContext.openChartとIContext.closeChartイベントをハンドルする。
2013年9月13日金曜日
2013年9月8日日曜日
Stopping strategy
Stopping strategy
ストラテジの停止
One retrieves strategy process id from IClient.startStrategy, which afterwards can be used to stop the strategy by using the IClient.stopStrategy method.
IClient.startStrategyからストラテジのプロセスIDを取得した後、IClient.stopStrategyメソッドを使うことで、ストラテジの停止が可能である。
Consider a program which starts an anonymous strategy and checks every second if the user has typed in the console "stop", if so then the program stops the strategy.
プログラムでストラテジを停止するならば、匿名のストラテジを開始して、毎秒ユーザがコンソールに"stop"とタイプするかをチェックするプログラムを検討してほしい。
final long strategyId = client.startStrategy(new IStrategy(){
public Instrument instrument = Instrument.EURUSD;
private IConsole console;
public void onStart(IContext context) throws JFException {
console = context.getConsole();
}
public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {
if ( instrument == this.instrument){
console.getOut().println(" bar: " + period + " " + askBar);
}
}
public void onTick(Instrument instrument, ITick tick) throws JFException { }
public void onMessage(IMessage message) throws JFException { }
public void onAccount(IAccount account) throws JFException { }
public void onStop() throws JFException { }
});
//now it's running
//every second check if "stop" had been typed in the console - if so - then stop the strategy
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
Scanner s = new Scanner(System.in);
while(true){
while(s.hasNext()){
String str = s.next();
if(str.equalsIgnoreCase("stop")){
System.out.println("Strategy stop by console command.");
client.stopStrategy(strategyId);
break;
}
}
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
});
thread.start();
MainStopFromConsole.java
ストラテジの停止
One retrieves strategy process id from IClient.startStrategy, which afterwards can be used to stop the strategy by using the IClient.stopStrategy method.
IClient.startStrategyからストラテジのプロセスIDを取得した後、IClient.stopStrategyメソッドを使うことで、ストラテジの停止が可能である。
Consider a program which starts an anonymous strategy and checks every second if the user has typed in the console "stop", if so then the program stops the strategy.
プログラムでストラテジを停止するならば、匿名のストラテジを開始して、毎秒ユーザがコンソールに"stop"とタイプするかをチェックするプログラムを検討してほしい。
final long strategyId = client.startStrategy(new IStrategy(){
public Instrument instrument = Instrument.EURUSD;
private IConsole console;
public void onStart(IContext context) throws JFException {
console = context.getConsole();
}
public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {
if ( instrument == this.instrument){
console.getOut().println(" bar: " + period + " " + askBar);
}
}
public void onTick(Instrument instrument, ITick tick) throws JFException { }
public void onMessage(IMessage message) throws JFException { }
public void onAccount(IAccount account) throws JFException { }
public void onStop() throws JFException { }
});
//now it's running
//every second check if "stop" had been typed in the console - if so - then stop the strategy
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
Scanner s = new Scanner(System.in);
while(true){
while(s.hasNext()){
String str = s.next();
if(str.equalsIgnoreCase("stop")){
System.out.println("Strategy stop by console command.");
client.stopStrategy(strategyId);
break;
}
}
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
});
thread.start();
MainStopFromConsole.java
2013年9月7日土曜日
Running strategies
Running strategies
ストラテジの実行
One runs a strategy by passing it to IClient.startStrategy, for instance:
インスタンスとして、IClient.startStrategyへストラテジを一つ渡して実行する。
client.startStrategy(new MA_Play());
One might also run multiple strategies.
複数のストラテジを実行するかもしれない。
For instance, one might run two instances of the same strategy but with different parameters:
インスタンスとして、2つの同じだがパラメータの異なるストラテジを実行するかもしれない。
StrategySimple strategy1 = new StrategySimple();
StrategySimple strategy2 = new StrategySimple();
strategy1.amount = 0.01;
strategy1.stopLossPips = 20;
strategy1.takeProfitPips = 10;
strategy2.amount = 0.02;
strategy2.stopLossPips = 60;
strategy2.takeProfitPips = 60;
client.startStrategy(strategy1);
client.startStrategy(strategy2);
ストラテジの実行
One runs a strategy by passing it to IClient.startStrategy, for instance:
インスタンスとして、IClient.startStrategyへストラテジを一つ渡して実行する。
client.startStrategy(new MA_Play());
One might also run multiple strategies.
複数のストラテジを実行するかもしれない。
For instance, one might run two instances of the same strategy but with different parameters:
インスタンスとして、2つの同じだがパラメータの異なるストラテジを実行するかもしれない。
StrategySimple strategy1 = new StrategySimple();
StrategySimple strategy2 = new StrategySimple();
strategy1.amount = 0.01;
strategy1.stopLossPips = 20;
strategy1.takeProfitPips = 10;
strategy2.amount = 0.02;
strategy2.stopLossPips = 60;
strategy2.takeProfitPips = 60;
client.startStrategy(strategy1);
client.startStrategy(strategy2);
2013年9月6日金曜日
Subscribing to instruments
Subscribing to instruments
インスツルメンツへのサブスクライブ
In contrary to JForex client, in Standalone API one always has to explicitly subscribe to all instruments that his strategy is going to use.
JForexクライアントに反し、スタンドアロンAPIの一つは、常に明示的に、ストラテジの使用予定として、全インスツルメントをサブスクラブする必要がある。
This can be done by using the setSubscribedInstruments method.
これは、setSubscribedInstrumentsメソッドを用いて行うことができる。
Note that the subscription is asynchronous, thus if the in it is advised to subscribe in the following way:
サブスクリプションが非同期であることに注意すべき、それゆえ、その中にあるならば、それは以下のようにしてサブスクライブするよう助言される:
インスツルメンツへのサブスクライブ
In contrary to JForex client, in Standalone API one always has to explicitly subscribe to all instruments that his strategy is going to use.
JForexクライアントに反し、スタンドアロンAPIの一つは、常に明示的に、ストラテジの使用予定として、全インスツルメントをサブスクラブする必要がある。
This can be done by using the setSubscribedInstruments method.
これは、setSubscribedInstrumentsメソッドを用いて行うことができる。
Note that the subscription is asynchronous, thus if the in it is advised to subscribe in the following way:
サブスクリプションが非同期であることに注意すべき、それゆえ、その中にあるならば、それは以下のようにしてサブスクライブするよう助言される:
2013年9月4日水曜日
System listener
System listener
システムリスナ
ISystemListener interface allows the user to execute some business logic on system connects and disconnects as well as on start and stop of every strategy.
ISystemListenerインタフェイスは、全ストラテジの開始や終了と同様、システムの接続や切断を行う際に、幾つかのビジネスロジックの実行を可能にする。
System listener gets added to IClient by using the setSystemListener method, for instance:
システムリスナは、setSystemListenerメソッドを使うことで、IClientインスタンスへ追加される。
システムリスナ
ISystemListener interface allows the user to execute some business logic on system connects and disconnects as well as on start and stop of every strategy.
ISystemListenerインタフェイスは、全ストラテジの開始や終了と同様、システムの接続や切断を行う際に、幾つかのビジネスロジックの実行を可能にする。
System listener gets added to IClient by using the setSystemListener method, for instance:
システムリスナは、setSystemListenerメソッドを使うことで、IClientインスタンスへ追加される。
2013年9月3日火曜日
IClient functionality
IClient functionality
IClientの機能性
IClient interface is used for working with live data and ITesterClient inherits its functionality for working with historical data.
IClientインタフェイスはライブデータを操作するために使用され、ITesterClientは履歴データを操作するために、その機能を継承している。
One gets an instance of IClient by using ClientFactory.getDefaultInstance().
ClientFactory.getDefaultInstance()を使うことでIClientのインスタンスを取得する。
One connects to dukascopy servers by using the connect method, for example:
例題のように、connectメソッドを使うことで、dukascopyサーバに接続する。
client.connect("https://www.dukascopy.com/client/demo/jclient/jforex.jnlp", "username", "password");
IClientの機能性
IClient interface is used for working with live data and ITesterClient inherits its functionality for working with historical data.
IClientインタフェイスはライブデータを操作するために使用され、ITesterClientは履歴データを操作するために、その機能を継承している。
One gets an instance of IClient by using ClientFactory.getDefaultInstance().
ClientFactory.getDefaultInstance()を使うことでIClientのインスタンスを取得する。
One connects to dukascopy servers by using the connect method, for example:
例題のように、connectメソッドを使うことで、dukascopyサーバに接続する。
client.connect("https://www.dukascopy.com/client/demo/jclient/jforex.jnlp", "username", "password");
2013年9月2日月曜日
JForex SDK
JForex理解度向上の為、SDKドキュメントを翻訳。
JForex SDK
http://www.dukascopy.com/wiki/#JForex_SDK
JForex Software Development Kit (JForex SDK) allows the user to use JForex API without JForex client.
JForexソフトウェア開発キット (JForex SDK)は、JForexクライアントを使うことなく、JForex APIの使用を可能にする。
Most prominently it enables the user to run his strategies from a custom java application.
最も顕著に有効なのは、カスタムJavaアプリケーションから自身のストラテジの実行を可能にすることだ。
One uses the IClient interface for working with live data and ITesterClient for working with historical data.
まず、ライブデータを操作するにはIClientインターフェイス、過去データを扱うにはITesterClientのどちらか一つを使用する。
Also JForex SDK provides interfaces for working with charts outside JForex client, find examples in sections Work with charts and Backtesting in GUI mode.
またJForex SDKは、JForexクライアント外部でのチャート操作として機能するインタフェイスを提供しており、Work with chartsセクションやBacktesting in GUI modeセクションで例題を見つけて欲しい。
Go to Use in Eclipse or Use in NetBeans to download the SDK with examples and get started.
例題としてSDKをダウンロードするのに、Use in Eclipse、又はUse in NetBeansに向かい、すぐに始めて欲しい。
JForex SDK
http://www.dukascopy.com/wiki/#JForex_SDK
JForex Software Development Kit (JForex SDK) allows the user to use JForex API without JForex client.
JForexソフトウェア開発キット (JForex SDK)は、JForexクライアントを使うことなく、JForex APIの使用を可能にする。
Most prominently it enables the user to run his strategies from a custom java application.
最も顕著に有効なのは、カスタムJavaアプリケーションから自身のストラテジの実行を可能にすることだ。
One uses the IClient interface for working with live data and ITesterClient for working with historical data.
まず、ライブデータを操作するにはIClientインターフェイス、過去データを扱うにはITesterClientのどちらか一つを使用する。
Also JForex SDK provides interfaces for working with charts outside JForex client, find examples in sections Work with charts and Backtesting in GUI mode.
またJForex SDKは、JForexクライアント外部でのチャート操作として機能するインタフェイスを提供しており、Work with chartsセクションやBacktesting in GUI modeセクションで例題を見つけて欲しい。
Go to Use in Eclipse or Use in NetBeans to download the SDK with examples and get started.
例題としてSDKをダウンロードするのに、Use in Eclipse、又はUse in NetBeansに向かい、すぐに始めて欲しい。
登録:
投稿 (Atom)