RangeBarFeedTest.java

注意事項:
サンプルソースコードには実際にオーダーを発注するものがあります。
サンプルソースコードのストラテジーを起動する場合は、注意して下さい。



// Copyright (c) 2009 Dukascopy (Suisse) SA. All Rights Reserved.
package jforex.feed.test.out;

import com.dukascopy.api.*;
import com.dukascopy.api.feed.*;
import com.dukascopy.api.feed.util.*;

public class RangeBarFeedTest implements IStrategy, IFeedListener {

    @Configurable("レンジバーフィード") 
    public RangeBarFeedDescriptor rangeBarFeedDescriptor = new RangeBarFeedDescriptor(
                                                               Instrument.EURUSD,
                                                               PriceRange.TWO_PIPS,
                                                               OfferSide.ASK
                                                           );

    private IConsole console;
    
    @Override
    public void onStart(IContext context) throws JFException {
        console = context.getConsole();
        context.setSubscribedInstruments(java.util.Collections.singleton(rangeBarFeedDescriptor.getInstrument()), true);
        context.subscribeToFeed(rangeBarFeedDescriptor, this);
    }
    
    @Override
    public void onFeedData(IFeedDescriptor feedDescriptor, ITimedData feedData) {
        IRangeBar rangeBar = (IRangeBar)feedData;
        console.getOut().println("Completed range bar's close price: " + rangeBar.getClose());
    }
    
    public void onTick(Instrument instrument, ITick tick) throws JFException {    }
    public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {    }
    public void onMessage(IMessage message) throws JFException {    }
    public void onAccount(IAccount account) throws JFException {    }
    public void onStop() throws JFException {    }
}







スポンサーリンク

スポンサーリンク
検索
リファレンスツリー


Copyright ©2016 JForexAPIで自動売買させ隊! All Rights Reserved.


Top

inserted by FC2 system