Code Monkey home page Code Monkey logo

Comments (7)

jaggedsoft avatar jaggedsoft commented on May 27, 2024 1

Thank you very much

from php-binance-api.

dmzoneill avatar dmzoneill commented on May 27, 2024 1

@jaggedsoft @webvoicenl

what do you think of this?

public function order($side, $symbol, $quantity, $price, $type = "LIMIT", $flags = []) {
		$opt = [
			"symbol" => $symbol,
			"side" => $side,
			"type" => $type,
			"quantity" => $quantity,
			"recvWindow" => 60000
		];

		// someone has preformated there 8 decimal point double already
		// dont do anything, leave them do whatever they want
		if( gettype( $price ) != "string" ) {
			// for every other type, lets format it appropriately
			$price = number_format($price, 8, '.', '');	
		}
		
		if ( $type === "LIMIT" || $type === "STOP_LOSS_LIMIT" || $type === "TAKE_PROFIT_LIMIT" ) {
			$opt["price"] = $price;
			$opt["timeInForce"] = "GTC";
		}
		if ( isset($flags['stopPrice']) ) $opt['stopPrice'] = $flags['stopPrice'];
		if ( isset($flags['icebergQty']) ) $opt['icebergQty'] = $flags['icebergQty'];
		if ( isset($flags['newOrderRespType']) ) $opt['newOrderRespType'] = $flags['newOrderRespType'];
		return $this->httpRequest("v3/order", "POST", $opt, true);
	}

image

from php-binance-api.

dmzoneill avatar dmzoneill commented on May 27, 2024

please assign this to me if its still valid

from php-binance-api.

jaggedsoft avatar jaggedsoft commented on May 27, 2024

Yeah this needs to be done, either transparently in the order function, and/or provide a shortcut function for this:

return number_format($price, 8, '.', '')

from php-binance-api.

jaggedsoft avatar jaggedsoft commented on May 27, 2024

Oh yeah, love it. Nice work.

from php-binance-api.

jaggedsoft avatar jaggedsoft commented on May 27, 2024

Thanks!!

from php-binance-api.

dmzoneill avatar dmzoneill commented on May 27, 2024

I'll do a few more tests tomorrow before commiting.. sensitive change...

from php-binance-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.