ig-trader
Version:
A client to programmatically spreadbet with IG
7 lines • 340 B
JavaScript
module.exports = {
getMidPrice: (lowerPrice, upperPrice) => {
const standardMidPrice = upperPrice > lowerPrice && (lowerPrice + ((upperPrice - lowerPrice) / 2))
const scewedMidPrice = upperPrice < lowerPrice && (upperPrice + ((lowerPrice - upperPrice) / 2 ))
return standardMidPrice || scewedMidPrice || upperPrice
}
}