Bid
Returns the current bid price.
Syntax
Bid(): number
Return Value
Returns a number
representing the current bid price.
Description
The Bid
method returns the current bid price for the symbol. The bid price is the price at which the market is willing to buy the base currency (in forex) or the asset (in other markets).
Example
// Get current bid price
const currentBid = this.api.Bid();
console.log(`Current bid price: ${currentBid}`);
// Calculate spread
const spread = this.api.Ask() - this.api.Bid();
console.log(`Current spread: ${spread}`);
// Use in trading decisions
if (this.api.Bid() > previousPrice) {
// Price has increased
// Implement trading logic
}
Last updated