Price orders at the provider's real trade rate instead of the mid quote.
montzar_live_price is the midpoint between the colleague's buy and sell rates, so orders priced straight from it charged the customer less than we pay the provider and the whole spread was lost on every trade, even though the app already showed the correct side. Order base price now follows the traded side (base + spread on buy, base - spread on sell), which also makes price_original the real cost basis so the dashboard stops counting the provider spread as profit. Conditional order triggers compare against the same displayed price. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -132,6 +132,22 @@ class ConfigService
|
||||
return $this->displayBuyPriceDiffRial();
|
||||
}
|
||||
|
||||
/**
|
||||
* اختلاف دوطرفهٔ نرخ همکار (نصف فاصلهٔ نرخ خرید و فروش همکار).
|
||||
*
|
||||
* پایهٔ ذخیرهشده (montzar_live_price) وسط این دو نرخ است، پس نرخ واقعی معاملهٔ ما با همکار
|
||||
* «پایه + این مقدار» برای خرید و «پایه − این مقدار» برای فروش است.
|
||||
* فقط برای provider همکار معنا دارد؛ بقیه نرخ دوطرفه نمیدهند.
|
||||
*/
|
||||
public function providerTradeSpreadRial(): float
|
||||
{
|
||||
if ($this->priceProvider() !== 'montzar') {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
return max(0.0, (float) $this->get('montzar_diff', 0));
|
||||
}
|
||||
|
||||
/** درصد کارمزد سفارش — fee_service_charge_percentage، service_charge_percentage، config/fee.php */
|
||||
public function orderServiceChargePercentage(): float
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user