@@ -3868,8 +3868,17 @@ signed_transaction wallet_api::sell( string seller_account,
3868
3868
double amount,
3869
3869
bool broadcast )
3870
3870
{
3871
- return my->sell_asset ( seller_account, std::to_string ( amount ), base,
3872
- std::to_string ( rate * amount ), quote, 0 , false , broadcast );
3871
+ std::ostringstream amount_to_sell;
3872
+ std::ostringstream min_to_receive;
3873
+
3874
+ uint8_t sell_precision = get_asset (base).precision ;
3875
+ uint8_t recv_precision = get_asset (quote).precision ;
3876
+
3877
+ amount_to_sell << std::fixed << std::setprecision (sell_precision) << amount;
3878
+ min_to_receive << std::fixed << std::setprecision (recv_precision) << rate * amount;
3879
+
3880
+ return my->sell_asset ( seller_account, amount_to_sell.str (), base,
3881
+ min_to_receive.str (), quote, 0 , false , broadcast );
3873
3882
}
3874
3883
3875
3884
signed_transaction wallet_api::buy ( string buyer_account,
@@ -3879,8 +3888,17 @@ signed_transaction wallet_api::buy( string buyer_account,
3879
3888
double amount,
3880
3889
bool broadcast )
3881
3890
{
3882
- return my->sell_asset ( buyer_account, std::to_string ( rate * amount ), quote,
3883
- std::to_string ( amount ), base, 0 , false , broadcast );
3891
+ std::ostringstream amount_to_buy;
3892
+ std::ostringstream min_to_receive;
3893
+
3894
+ uint8_t buy_precision = get_asset (quote).precision ;
3895
+ uint8_t recv_precision = get_asset (base).precision ;
3896
+
3897
+ amount_to_buy << std::fixed << std::setprecision (buy_precision) << rate * amount;
3898
+ min_to_receive << std::fixed << std::setprecision (recv_precision) << amount;
3899
+
3900
+ return my->sell_asset ( buyer_account, amount_to_buy.str (), quote,
3901
+ min_to_receive.str (), base, 0 , false , broadcast );
3884
3902
}
3885
3903
3886
3904
signed_transaction wallet_api::borrow_asset (string seller_name, string amount_to_sell,
0 commit comments