@Test public void calculatesVolumeCorrectly() { final Volume volume1 = cut.calculateVolumeForTrade(new AccuratePrice(0.000005), new Price(200), new Money(100, 0, "EUR")); assertThat(volume1).isEqualTo(new Volume(100000, VolumeUnit.BASE)); final Volume volume2 = cut.calculateVolumeForTrade(new AccuratePrice(0.000022), new Price(50), new Money(4000, 0, "USD")); assertThat(volume2).isEqualTo(new Volume(3636363, VolumeUnit.BASE)); }
public Volume calculateVolumeForTrade(final AccuratePrice pricePerPipette, final Price pipLostOnStopLoose, final Money moneyToRisk) { final double rawMoney = (double) moneyToRisk.asRawValue() / 100; final double loosePer1Volume = pricePerPipette.asRawValue() * pipLostOnStopLoose.asPipette(); return new Volume((long) (rawMoney / loosePer1Volume), VolumeUnit.BASE); }
VolumeCalculator { public Volume calculateVolumeForTrade(final AccuratePrice pricePerPipette, final Price pipLostOnStopLoose, final Money moneyToRisk) { final double rawMoney = (double) moneyToRisk.asRawValue() / 100; final double loosePer1Volume = pricePerPipette.asRawValue() * pipLostOnStopLoose.asPipette(); return new Volume((long) (rawMoney / loosePer1Volume), VolumeUnit.BASE); } }
VolumeCalculator { public Volume calculateVolumeForTrade(final AccuratePrice pricePerPipette, final Price pipLostOnStopLoose, final Money moneyToRisk) { final double rawMoney = (double) moneyToRisk.asRawValue() / 100; final double loosePer1Volume = pricePerPipette.asRawValue() * pipLostOnStopLoose.asPipette(); return new Volume((long) (rawMoney / loosePer1Volume), VolumeUnit.BASE); }  }
VolumeCalculator { public Volume calculateVolumeForTrade(final AccuratePrice pricePerPipette, final Price pipLostOnStopLoose, final Money moneyToRisk) { final double rawMoney = (double) moneyToRisk.asRawValue() / 100; final double loosePer1Volume = pricePerPipette.asRawValue() * pipLostOnStopLoose.asPipette(); return new Volume((long) (rawMoney / loosePer1Volume), VolumeUnit.BASE); }  Volume calculateVolumeForTrade(final AccuratePrice pricePerPipette, final Price pipLostOnStopLoose,
            final Money moneyToRisk); }
VolumeCalculator { public Volume calculateVolumeForTrade(final AccuratePrice pricePerPipette, final Price pipLostOnStopLoose, final Money moneyToRisk) { final double rawMoney = (double) moneyToRisk.asRawValue() / 100; final double loosePer1Volume = pricePerPipette.asRawValue() * pipLostOnStopLoose.asPipette(); return new Volume((long) (rawMoney / loosePer1Volume), VolumeUnit.BASE); }  Volume calculateVolumeForTrade(final AccuratePrice pricePerPipette, final Price pipLostOnStopLoose,
            final Money moneyToRisk);  }