hzjken / crypto-arbitrage-framework

A cryptocurrency arbitrage framework implemented with ccxt and cplex. It can be used to monitor multiple exchanges, find a multi-lateral arbitrage path which maximizes rate of return, calculate the optimal trading amount for each pair in the path given flexible constraints, and execute trades with multi-threading implemenation.
552 stars 172 forks source link

Any cplex alternative ? #9

Open Pascal66 opened 3 years ago

Pascal66 commented 3 years ago

Searching for something equivalent. for example java simplexsolver

Technaut commented 3 years ago

I found a clean cplex student version 12.8 online. It was on a university site. It works but now there is another issue with the code. I can send the file to you or try and find the site again in my history

jechaviz commented 3 years ago

It would be amazing if you can share the link and/or share the file with wetransfer.com, gofile.io, or other file sharing service friend. Ty very much. My email is jesus.cgalaviz@gmail.com

Pascal66 commented 3 years ago

I'm searching to NOT use cplex

Duzzadan commented 3 years ago

anyone found a solution to this yet?

brylie commented 3 years ago

scipy.optimize.linprog(..., method='simplex')?

https://docs.scipy.org/doc/scipy/reference/optimize.linprog-simplex.html

brylie commented 3 years ago

pulp.apis.CPLEX?

https://coin-or.github.io/pulp/technical/solvers.html?highlight=cplex#pulp.apis.CPLEX

brylie commented 3 years ago

Possibly a duplicate of #2

Pascal66 commented 3 years ago

pulp.apis.CPLEX?

https://coin-or.github.io/pulp/technical/solvers.html?highlight=cplex#pulp.apis.CPLEX

This one only wrap cplex, so scipy (as #2) is one of the only free improvment

hubuser3976 commented 3 years ago

pulp.apis.CPLEX? https://coin-or.github.io/pulp/technical/solvers.html?highlight=cplex#pulp.apis.CPLEX

This one only wrap cplex, so scipy (as #2) is one of the only free improvment

It is available on pypi.org installable with pip PuLP install

Github

Docs say it can do different problem solutions. Perhaps it is worth a look

Pascal66 commented 3 years ago

pulp call GLPK, COIN-OR CLP/CBC, CPLEX, GUROBI, MOSEK, XPRESS, CHOCO, MIPCL, SCIP to solve linear problems. It's a wrapper for them, so you need to install one of them

hubuser3976 commented 3 years ago

pulp call GLPK, COIN-OR CLP/CBC, CPLEX, GUROBI, MOSEK, XPRESS, CHOCO, MIPCL, SCIP to solve linear problems. It's a wrapper for them, so you need to install one of them

COIN-OR seems to be the most accessable in terms of ease of obtaining source code, building and installation. Problem is it's C++ and needs to be wrapped to produce Python bindings. Then there would be a need to produce a Python module to replace the Cplex Model module.

hubuser3976 commented 3 years ago

I have decided to document the steps I follow here so I can reproduce them if required.

I have used the coinbrew script to obtain source code for Osi, Cpc, Clp, Cgl and built and installed them in a local directory.

I am using Fedora 33 OS with "Development Tools" & Development Libraries" installed Python3.9 <== using this version in attempting to build CyLP

CyLP provides a Python interface for the COIN-OR cpp headers & libraries plus binaries generated from the build I am trying to build CyLP from source code but need to install Cython and re-generate the cpp files from my COIN-OR build, into the CyLP cpp directory in order to overcome a build error. <=== this idea failed as CyLP uses custom wrappers.

hubuser3976 commented 3 years ago

It seems the only solution is to code a cpp model that can handle the def.'s of classes in a similar way to docplex.mp.model Once completed the cpp model handler can be used to generate a python3 module that can be installed locally in my venv with pip3. That said, it will take some time before the module is ready to use. This represents a custom solution, of course. Incidently, .../USER_HOME/YOUR_PROJECT_FOLDER/YOUR_VENV_FOLDER/lib/site-packages/docplex/mp/model.py can be accessed and read to gain insight into the modelling behaviour of docplex.

According to the comments within model.py, the with statement can be used to generate a modelling context. Perhaps this could be used from within COIN-OR Osi, Cbc, Clp & gcl to process the needed pathways of crypto-arbitrage-framework. <===FAILED. the model context is handled by cplex_config.py

Interestingly, model.py and cplex_config.py have Apache License, Version 2.0

Pascal66 commented 3 years ago

scipy.optimize.linprog(..., method='simplex')?

https://docs.scipy.org/doc/scipy/reference/optimize.linprog-simplex.html

@hubuser3976 : This is only a simplex. Many python lib have a simplex. The best one is using scipy as @brylie wrote above No need to reinvent the wheel or worse, rewrite a wrapper

hubuser3976 commented 3 years ago

scipy.optimize.linprog(..., method='simplex')? https://docs.scipy.org/doc/scipy/reference/optimize.linprog-simplex.html

@hubuser3976 : This is only a simplex. Many python lib have a simplex. The best one is using scipy as @brylie wrote above No need to reinvent the wheel or worse, rewrite a wrapper

Noted and agreed. CyLP uses both numpy and scipy, plus it provides a simplex from COIN-OR Clp https://pypi.org/project/cylp/

import numpy as np from cylp.cy import CyClpSimplex from cylp.py.modeling.CyLPModel import CyLPArray

s = CyClpSimplex()

https://github.com/coin-or/cylp