Giter Site home page Giter Site logo

r1ck404 / crypto-exchange-example Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 1.0 22 KB

A small crypto exchange example.

License: Apache License 2.0

PHP 100.00%
crypto-exchange cryptocurrency encryption-decryption exchange php small-project user-management

crypto-exchange-example's Introduction

Quick note, the code isnt perfect.

Crypto Exchange Example

This project is a Crypto Exchange Example written in PHP. It is a small, flexible, and extensible application that allows users to easily add and work with different exchanges. The project includes the Binance exchange as an example, but other exchanges can easily be added as well. Whether you are a beginner or an experienced developer, this project is a great resource for learning about and building your own crypto exchange. Its easy-to-use design makes it simple to work with and edit, so you can quickly get up and running with your own exchange. Whether you want to integrate a single exchange or multiple exchanges, this project has you covered.

Features

  • Users
  • Password Encryption & Decryption.
  • Exchange Sockets
  • Different Exchanges

FAQ

Is this a fully ready crypto exchange?

Sadly, no. This is just a small example of a crypto exchange.

Does this project include frontend?

No it does not. This project is mainly backend, there are a few small frontend examples.

Usage/Examples

Create an user

$usermanager = new UserManager();
$usermanager->createUser('username', 'password');

Get an user

$usermanager = new UserManager();
$usermanager->getUser('username');

How to add a custom exchange?

Go to Resources/php/Exchange/exchanges

Create a file named ExchangeName.php

Then

Add the namespace, and import the Exchange file.

<?php

namespace Resources\Php\Exchange\exchanges;

use Resources\Php\Exchange\Exchange;

<?php

Then

Create the class, add the construct and the getEndPoints function.

<?php

namespace Resources\Php\Exchange\exchanges;

use Resources\Php\Exchange\Exchange;

class ExchangeName extends Exchange {

    public function __construct(string $apiKey, string $apiSecret)
    {
        $this->setEndPoints([
            "api" => "https://api.exchange.com", // Dont leave empty
            "api1" => "https://api1.exchange.com", // can be left empty
            "api2" => "https://api2.exchange.com", // can be left empty
            "api3" => "https://api3.exchange.com", // can be left empty

            "spot-trading" => "/api/v3/", //spot endpoint
            "futures" => "/sapi/v1/futures/", //futures endpoint
            "futures-algo" => "/sapi/v1/algo/futures/", //futures algo endpoint
            "fiat" => "/sapi/v1/fiat/", //fiat endpoint
            "margin" => "/sapi/v1/margin/", //margin endpoint
            "nft" => "/sapi/v1/nft/", //nft endpoint

            "market" => "/api/v3/", //market endpoint
            "wallet" => "/sapi/v1/", //wallet endpoint
            "sub-account" => "/sapi/v1/sub-account/", //sub-acc endpoint

            "mining" => "/sapi/v1/mining/", //mining endpoint
            "staking" => "/sapi/v1/staking/", //staking endpoint
            "saving" => "/sapi/v1/lending/" //saving endpoint
        ]);

        $this->apiKey = $apiKey; //The users api key.
        $this->apiSecret = $apiSecret; //The users api secret.

        parent::__construct($apiKey, $apiSecret);
    }

    public function getEndPoints(): array
    {
        return $this->endPoints;
    }
}

?>

License

APACHE-2.0

Support

Im not sure if i will continue to work on this project, but if people want me to i will probaly continue. For private support, Contact me via discord Rick404#8294.

crypto-exchange-example's People

Contributors

r1ck404 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

c4ei

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.