当前位置: 首页>>代码示例>>Java>>正文


Java OfferSide类代码示例

本文整理汇总了Java中com.dukascopy.api.OfferSide的典型用法代码示例。如果您正苦于以下问题:Java OfferSide类的具体用法?Java OfferSide怎么用?Java OfferSide使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


OfferSide类属于com.dukascopy.api包,在下文中一共展示了OfferSide类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: check

import com.dukascopy.api.OfferSide; //导入依赖的package包/类
@Override
protected void check(Signal challenge) {
	IIndicators indicators = StateMachine.getInstance().getContext().getIndicators();
	double adx = 0;
	try {
		adx = indicators.adx(challenge.getInstrument(), challenge.getPeriod(), OfferSide.ASK, 13, 1);
	} catch (JFException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	switch (trend) {
	case StateMachine.TREND:
		if (adx < limit) {
			setExclusion();
		}
		break;
	case StateMachine.CHAOS:
		if (adx > limit) {
			setExclusion();
		}
	default:
		break;
	}

}
 
开发者ID:csikosbalint,项目名称:forex-strategy,代码行数:26,代码来源:TrendADXExclusion.java

示例2: marginForCrossCurrency

import com.dukascopy.api.OfferSide; //导入依赖的package包/类
private double marginForCrossCurrency(final ICurrency crossCurrency) {
    final double conversionLot = calculationUtil.convertAmount(lotSize(),
                                                               crossCurrency,
                                                               currency(),
                                                               OfferSide.ASK);
    return conversionLot / leverage();
}
 
开发者ID:juxeii,项目名称:dztools,代码行数:8,代码来源:AccountInfo.java

示例3: createParams

import com.dukascopy.api.OfferSide; //导入依赖的package包/类
private BarParams createParams(final Instrument instrument,
                               final BrokerHistoryData brokerHistoryData) {
    final Period period = TimeConvert.getPeriodFromMinutes(brokerHistoryData.periodInMinutes());
    return BarParams
        .forInstrument(instrument)
        .period(period)
        .offerSide(OfferSide.ASK);
}
 
开发者ID:juxeii,项目名称:dztools,代码行数:9,代码来源:BarFetcher.java

示例4: pipCostCalculationIsCorrect

import com.dukascopy.api.OfferSide; //导入依赖的package包/类
@Test
public void pipCostCalculationIsCorrect() {
    final double mockedPipCost = 42.42;

    when(calculationUtilMock.pipValueInCurrency(lotSize,
                                                tradeInstrument,
                                                accountCurrency,
                                                OfferSide.ASK))
                                                    .thenReturn(mockedPipCost);

    assertThat(accountInfo.pipCost(tradeInstrument), equalTo(mockedPipCost));
}
 
开发者ID:juxeii,项目名称:dztools,代码行数:13,代码来源:AccountInfoTest.java

示例5: marginPerLotCalculationIsCorrect

import com.dukascopy.api.OfferSide; //导入依赖的package包/类
@Test
public void marginPerLotCalculationIsCorrect() {
    final Instrument instrumentForCalculation = Instrument.GBPAUD;
    final double mockedConversionAmount = 0.123;

    when(calculationUtilMock.convertAmount(lotSize,
                                           CurrencyFactory.GBP,
                                           accountCurrency,
                                           OfferSide.ASK))
                                               .thenReturn(mockedConversionAmount);

    assertThat(accountInfo.marginPerLot(instrumentForCalculation),
               equalTo(mockedConversionAmount / leverage));
}
 
开发者ID:juxeii,项目名称:dztools,代码行数:15,代码来源:AccountInfoTest.java

示例6: Bars

import com.dukascopy.api.OfferSide; //导入依赖的package包/类
public Object Bars(String instrument, String per, String nb) throws ParseException, JFException{
	
	Period period = parsePeriod(per);
	int n= Integer.parseInt(nb);
	Instrument inst = parseInstrument(instrument);
	return history.getBars(inst, period, OfferSide.BID, Filter.NO_FILTER, n, history.getStartTimeOfCurrentBar(inst, period) , 0);
}
 
开发者ID:caub,项目名称:JForexJetty,代码行数:8,代码来源:DataStrategy.java

示例7: calc

import com.dukascopy.api.OfferSide; //导入依赖的package包/类
@Override
protected double calc(Signal challenge, Period period, IBar askBar, IBar bidBar, State actual) {
	IIndicators indicators = StateMachine.getInstance().getContext().getIndicators();
	try {
		/*
		 * ASK
		 */
		double sma55weekly = indicators.sma(challenge.getInstrument(), Period.WEEKLY, OfferSide.ASK, AppliedPrice.MEDIAN_PRICE, 55, 0);
		double sma21daily = indicators.sma(challenge.getInstrument(), Period.DAILY, OfferSide.ASK, AppliedPrice.MEDIAN_PRICE, 21, 0);
		double sma34fhours = indicators.sma(challenge.getInstrument(), Period.FOUR_HOURS, OfferSide.ASK, AppliedPrice.CLOSE, 34, 0);
		double price = askBar.getClose();
		if ( price > sma55weekly && price > sma21daily && price > sma34fhours ) {
			challenge.setType(OrderCommand.SELL);
			return this.max;
		}
		sma55weekly = indicators.sma(challenge.getInstrument(), Period.WEEKLY, OfferSide.BID, AppliedPrice.MEDIAN_PRICE, 55, 0);
		sma21daily = indicators.sma(challenge.getInstrument(), Period.DAILY, OfferSide.BID, AppliedPrice.MEDIAN_PRICE, 21, 0);
		sma34fhours = indicators.sma(challenge.getInstrument(), Period.FOUR_HOURS, OfferSide.BID, AppliedPrice.CLOSE, 34, 0);
		price = bidBar.getClose();
		if ( price < sma55weekly && price < sma21daily && price < sma34fhours ) {
			challenge.setType(OrderCommand.BUY);
			return this.max;
		}
	} catch (JFException e1) {
		// TODO Auto-generated catch block
		e1.printStackTrace();
	}
	return 0;
}
 
开发者ID:csikosbalint,项目名称:forex-strategy,代码行数:30,代码来源:ThreePigsOpen.java

示例8: pipCost

import com.dukascopy.api.OfferSide; //导入依赖的package包/类
public double pipCost(final Instrument instrument) {
    return calculationUtil.pipValueInCurrency(lotSize(),
                                              instrument,
                                              currency(),
                                              OfferSide.ASK);
}
 
开发者ID:juxeii,项目名称:dztools,代码行数:7,代码来源:AccountInfo.java

示例9: assertSetSLParamsValues

import com.dukascopy.api.OfferSide; //导入依赖的package包/类
@Test
public void assertSetSLParamsValues() {
    assertThat(setSLParams.order(), equalTo(orderMockA));
    assertThat(setSLParams.offerSide(), equalTo(OfferSide.ASK));
    assertThat(setSLParams.priceOrPips(), equalTo(slPrice));
}
 
开发者ID:juxeii,项目名称:dztools,代码行数:7,代码来源:SetSLParamsFactoryTest.java


注:本文中的com.dukascopy.api.OfferSide类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。