aureliano90 / futures-spot-arbitrage-okex-v5 Goto Github PK
View Code? Open in Web Editor NEWAn async program for futures-spot arbitrage on OKEx using V5 API.
License: GNU Affero General Public License v3.0
An async program for futures-spot arbitrage on OKEx using V5 API.
License: GNU Affero General Public License v3.0
Hi there,
I'm going through your code checking a little bit the concept.
Out of the box i get this error:
async def get_crypto(accountid: int) -> tuple[str, Monitor]: TypeError: 'type' object is not subscriptable
Do you know what could be wrong here?
Hi there
Would appreciate a telegram group chat in order to talk FAQ and other bug orientated solutions, this might be quite technical for people that are not very familiar with coding.
For example, my self I can not understand where to enter my priv keys and although I made a .env file I still get error when running the command 1.
So, on debian using virtualenv with python 3.9 when I try to use monitor. (demo account)
Regards.
1
Crypto Current Predicted
SOL -0.016% -0.001%
SOL Today's APR: -11.34%, 7 day APR: -1.62%, overall APR: -1211.42%
SOL Today's APY: -10.72%, 7 day APY: -1.61%, overall APY: -100.00%
menu.py:36: RuntimeWarning: coroutine 'run_with_cancel.<locals>.wrapper.<locals>._coro' was never awaited
mon.watch()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
menu.py:36: RuntimeWarning: coroutine 'Monitor.watch' was never awaited
mon.watch()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
I'm not sure I really understand the principle. does he manage on his own? I need to close my positions manually, right?
I need to use screen to fetch/monitor ? thanks
hello, im using the latest version on linux and I get this stdout when I fetch Ticker (5):
Process Process-2:
Traceback (most recent call last):
File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
self.run()
File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/home/panpansh/Projects/Futures-Spot-Arbitrage-OKEx-V5/src/record.py", line 51, in record_ticker
loop.run_until_complete(record())
File "/usr/lib/python3.9/asyncio/base_events.py", line 623, in run_until_complete
self._check_running()
File "/usr/lib/python3.9/asyncio/base_events.py", line 583, in _check_running
raise RuntimeError('This event loop is already running')
RuntimeError: This event loop is already running
/usr/lib/python3.9/multiprocessing/process.py:331: RuntimeWarning: coroutine 'record' was never awaited
traceback.print_exc()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Futures-Spot-Arbitrage-OKEx-V5/src/monitor.py
Line 101 in 0385a64
Futures-Spot-Arbitrage-OKEx-V5/src/monitor.py
Line 148 in 0385a64
In src/menu.py, line 355: fundingRate = FundingRate()
, I suggest to change to: fundingRate = FundingRate(accountid)
, otherwise the fundingRate
object with always initialized with the default accountid, 3
, the object will always uses the test API.
Same issue goes to:
I did a proof of concept doing funding arbitrage on okx, while i was trying to make a production version i found your project which is exactly what i was trying to do. This really is great work.
But I was wondering why wouldnt you go cross margin usdt. It's very unlikely you will get a margin call considering the spread on okx. Like when your short position loose money, your long will gain some anyway. Doing isolated need stoplosses whereas cross shouldnt need any.
Is my thought wrong or please would you clarify on that ?
Thanks you for your work
This project was started when I was a newbie in Python and software development. I am glad it gathers a decent number of stars and hopefully some usage. However it feels outdated and lacking maintenance even though it still functions and makes money.
Therefore I'm soliciting feedbacks or suggestions to make an improvement plan. Given enough feedbacks and community contribution, an improvement plan will take effect.
My local MongoDB service is consuming 7 GBs of memory. It also seems to be slow.
Hereby suggestions for alternative dbs are welcomed. A switch will take place if there is enough demand and community contribution.
Hi, Aureliano90, I have this error if I try to monitor existing connections for example:
Monitor__await__(BTC) error
local variable 'json_res' referenced before assignment
Crypto BTC does not exist.
I have MongoDB running, may be I should configure it somehow?
Thank you
当初始化程序的时候,按下监控现有仓位这个功能时候,数据库里没有数据,会报一个数据库为空的错误,请问这个问题应该怎么解决呢
你好,在理解运行代码的时候遇到一些问题想请教下:
从src/monitor.py开始处的注释来看,该文件主要实现了以下三个功能:
# 1. 监控一个币种,如果当期资金费+预测资金费小于重新开仓成本(开仓期现差价-平仓期现差价-手续费),进行平仓。
# 2. 如果合约仓位到达下级杠杆,进行减仓。如果合约仓位到达上级杠杆,进行加仓。
# 3. 如果距离下期资金费3小时以上,(开仓期现差价-平仓期现差价-手续费)>0.2%,进行套利。
Question 1
1.1 对于注释中功能1. 我的理解是, 如果资金费利润(当期资金费+下期预测资金费)小于期现差价利润(开仓期现差价-平仓期现差价-手续费),则进行平仓直接赚取期现差价利润而舍弃资金费利润。请问这样理解是对的吗?你注释中所写的重新开仓成本就是开仓平仓是期现差价利润的意思吗? 如果不是可否麻烦解释下?
1.2 代码中147行计算重新开仓成本, cost = open_pd - close_pd + 2 * trade_fee
这里的trade_fee
为什么是相加而不是相减呢?
Futures-Spot-Arbitrage-OKEx-V5/src/monitor.py
Line 147 in 4361da6
1.3 代码143-146行中,开仓期现差价和平仓期现差价都是用该标的的过去一段时间内的统计平均加减标准差得来。为什么不能直接计算该仓位开仓时的期现差价,和当前时间点的期现差价作为平仓期现差价呢?
assert (recent := Stat.recent_open_stat()), lang.fetch_ticker_first
open_pd = recent['avg'] + recent['std']
recent = Stat.recent_close_stat()
close_pd = recent['avg'] - recent['std']
Question 2
对于注释中功能3.我好像没有在src/monitor.py找到相应的代码,是该功能还没有实现吗?或者是我遗漏了哪部分代码?
P.S. 代码写的好好,感谢无私的分享!!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.