public interface JFUtils
| Method Summary | |
|---|---|
double |
convert(Instrument instrumentFrom,
Instrument instrumentTo,
double amount)
Converts the amount from one instrument to another with precision of 0.1 instrumentTo pips. |
double |
convert(Instrument instrumentFrom,
Instrument instrumentTo,
double amount,
int decimalPlaces)
Converts the amount from one instrument to another. |
double |
convert(Instrument instrumentFrom,
Instrument instrumentTo,
double amount,
int decimalPlaces,
OfferSide offerSide)
Converts the amount from one instrument to another. |
double |
convertPipToCurrency(Instrument instrument,
java.util.Currency currency)
Converts the cost of one pip for particular instrument to specified currency. |
double |
convertPipToCurrency(Instrument instrument,
java.util.Currency currency,
OfferSide offerSide)
Converts the cost of one pip for particular instrument to specified currency |
long |
getTimeForNPeriodsBack(Period period,
long to,
int numberOfPeriods)
Returns starting time point of the time period that is (numberOfPeriods - 1) back in time to the time period that
includes time specified in to parameter. |
long |
getTimeForNPeriodsForward(Period period,
long from,
int numberOfPeriods)
Returns starting time point of the time period that is + (numberOfPeriods - 1) in the future to the time period that
includes time specified in from parameter. |
| Method Detail |
|---|
double convert(Instrument instrumentFrom,
Instrument instrumentTo,
double amount)
throws JFException
OfferSide.ASK and OfferSide.BID) gets used.
instrumentFrom - the instrument from which the amount to be convertedinstrumentTo - the instrument to which the amount to be convertedamount - the amount in instrumentFrom
JFException - if instrumentFrom or instrumentTo are null or not subscribed, if amount is 0 or less, if there is no active subscribed
inter-instrument that could be used in conversion (e.g. for conversion between NZD/CHF and GBP/USD none of the instruments
GBP/NZD, NZD/USD, GBP/CHF, USD/CHF are subscribed and active)
double convert(Instrument instrumentFrom,
Instrument instrumentTo,
double amount,
int decimalPlaces)
throws JFException
OfferSide.ASK and OfferSide.BID) gets used.
instrumentFrom - the instrument from which the amount to be convertedinstrumentTo - the instrument to which the amount to be convertedamount - the amount in instrumentFromdecimalPlaces - decimal places of the returned result
JFException - if instrumentFrom or instrumentTo are null or not subscribed, if amount is 0 or less, if there is no active subscribed
inter-instrument that could be used in conversion (e.g. for conversion between NZD/CHF and GBP/USD none of the instruments
GBP/NZD, NZD/USD, GBP/CHF, USD/CHF are subscribed and active)
double convert(Instrument instrumentFrom,
Instrument instrumentTo,
double amount,
int decimalPlaces,
OfferSide offerSide)
throws JFException
instrumentFrom - the instrument from which the amount to be convertedinstrumentTo - the instrument to which the amount to be convertedamount - the amount in instrumentFromdecimalPlaces - decimal places of the returned resultofferSide - the price used for conversion - BID or ASK. If the value is null, the median price between BID and ASK is used
JFException - if instrumentFrom or instrumentTo are null or not subscribed, if amount is 0 or less, if there is no active subscribed
inter-instrument that could be used in conversion (e.g. for conversion between NZD/CHF and GBP/USD none of the instruments
GBP/NZD, NZD/USD, GBP/CHF, USD/CHF are subscribed and active)
double convertPipToCurrency(Instrument instrument,
java.util.Currency currency)
throws JFException
OfferSide.ASK and OfferSide.BID) gets used.
instrument - Instrument which pip value will be convertedcurrency - the target currency of conversion
Instrument's pip value in specified currency.JFException
double convertPipToCurrency(Instrument instrument,
java.util.Currency currency,
OfferSide offerSide)
throws JFException
instrument - Instrument which pip value will be convertedcurrency - the target currency of conversionofferSide - the price used for conversion - BID or ASK. If the value is null, the median price between BID and ASK is used
Instrument's pip value in specified currency.JFException
long getTimeForNPeriodsBack(Period period,
long to,
int numberOfPeriods)
throws JFException
(numberOfPeriods - 1) back in time to the time period that
includes time specified in to parameter.
period - Period time period (Tick period is not supported).to - time included to the last period unitnumberOfPeriods - number of time periods back
(numberOfPeriods - 1) backward from the to time point)
JFException - when period is not supportedIDataService.getFXSentimentIndex(Currency, long),
IDataService.getFXSentimentIndex(Instrument, long),
IHistory.getTimeForNBarsBack(Period, long, int),
IHistory.getTimeForNBarsForward(Period, long, int)
long getTimeForNPeriodsForward(Period period,
long from,
int numberOfPeriods)
throws JFException
(numberOfPeriods - 1) in the future to the time period that
includes time specified in from parameter.
period - Period time period (Tick period is not supported).from - time included to the first period unitnumberOfPeriods - number of time periods forward
(numberOfPeriods - 1) forward from the from time point)
JFException - when period is not supportedIDataService.getFXSentimentIndex(Currency, long),
IDataService.getFXSentimentIndex(Instrument, long),
IHistory.getTimeForNBarsBack(Period, long, int),
IHistory.getTimeForNBarsForward(Period, long, int)