尝试使用以下命令从 docker 登录 gitlab:
sudo docker login registry.gitlab.com?private_token=XXX
Run Code Online (Sandbox Code Playgroud)
但我仍然有以下错误消息:
Error response from daemon: Get https://registry.gitlab.com/v2/: unauthorized: HTTP Basic: Access denied\nYou must use a personal access token with 'api' scope for Git over HTTP.\nYou can generate one at https://gitlab.com/-/profile/personal_access_tokens
Run Code Online (Sandbox Code Playgroud)
该令牌具有正确的访问权限,我仔细检查了...我对 docker 相当陌生,有任何提示/帮助吗?谢谢!
我目前正在尝试将 json 文件(我已经可以处理)中的值与 csv 文件中的值(这可能是问题所在)进行比较。我当前的代码如下所示:
for data in trades['timestamp']:
data = pd.to_datetime(data)
print(data)
if data == ask_minute['lastUpdated']:
#....'do something'
Run Code Online (Sandbox Code Playgroud)
这使:
":Series 的真值不明确。使用 a.empty、a.bool()、a.item()、a.any() 或 a.all()。"
我的当前print(data)看起来像这样:
2018-10-03 18:03:38.067000
2018-10-03 18:03:38.109000
2018-10-03 18:04:28
2018-10-03 18:04:28.685000
Run Code Online (Sandbox Code Playgroud)
但是,我仍然无法将 CSV 文件中的这些时间戳与 Json 文件中的时间戳进行比较。有人有想法吗?
我的第一个数据框df_gammask如下所示:
distance breakEvenDistance min max
0 2.1178 2.0934 NaN 0.000955
1 2.0309 2.1473 0.000955 0.001041
2 1.9801 1.7794 0.001041 0.001124
3 1.9282 2.1473 0.001124 0.001199
4 1.8518 1.5885 0.001199 0.001259
5 1.8518 1.5151 0.001259 0.001319
Run Code Online (Sandbox Code Playgroud)
我的第二个df_gammabid:
distance breakEvenDistance min max
0 1.9999 1.9329 NaN 0.001034
1 1.9251 2.0670 0.001034 0.001118
2 1.8802 1.6758 0.001118 0.001193
3 1.8802 1.5956 0.001193 0.001252
4 1.7542 1.5181 0.001252 0.001317
5 1.7542 1.4541 0.001317 0.001374
Run Code Online (Sandbox Code Playgroud)
我需要的是一个像这样的 json 文件:
{
"buy": [ …Run Code Online (Sandbox Code Playgroud) 我尝试使用 slack API 向工作区发送消息,我在他们的文档中找到了这段代码,但是我遇到了模块 slack 的问题。这是我使用的代码:
import os
import slack
client = slack.WebClient(token=os.environ['SLACK_API_TOKEN'])
response = client.chat_postMessage(
channel='#viktor',
text="Hello world!")
assert response["ok"]
assert response["message"]["text"] == "Hello world!"
Run Code Online (Sandbox Code Playgroud)
我已经放置了我的应用程序令牌,但它无法识别WebClient......知道吗?
我正在尝试使用以下小脚本在 slack 的频道上发送一个熊猫数据帧:
import requests
URL = 'XXXXXX'
response = requests.post(
URL, data={dataframe}
)
Run Code Online (Sandbox Code Playgroud)
但是当我这样做时,我收到以下错误消息:'DataFrame' objects are mutable, thus they cannot be hashed!我也尝试将它作为 json 发送,但它对用户来说是不可读的。关于如何正确执行此操作的任何想法?谢谢!
我的数据框看起来如下:
Bot instance Current Potential profit Potential Profit 24h ago Change last 24h Volume 24h Volume Market
0 Biki - TECUSDT 21.69386074 USDT 21.60458081 USDT 0.08927993 USDT 0.84554375 USDT 28577.2565559176490500
1 Binance - XEMBTC -3.55974813 BTC -3.55514961 BTC -0.00459852 BTC 11.31867593 BTC 924.7716585800000000
2 Binance - XEM/ETH -15.38320177 ETH -15.32533185 ETH -0.05786992 ETH …Run Code Online (Sandbox Code Playgroud) 我试图将该数字从数据帧转换为日期时间,列 time['date'] 如下所示:
0 1.575263e+12
1 1.575263e+12
2 1.575263e+12
3 1.575263e+12
4 1.575307e+12
...
95 1.576521e+12
96 1.576521e+12
97 1.576521e+12
98 1.576521e+12
99 1.576521e+12
Name: date, Length: 100, dtype: float64
Run Code Online (Sandbox Code Playgroud)
我尝试了以下方法:
print(pd.to_datetime(time['date'], unit='s'))
Run Code Online (Sandbox Code Playgroud)
但我在标题中遇到了问题,如果我尝试不使用unit='s'该列,则如下所示:
0 1970-01-01 00:26:15.262698000
1 1970-01-01 00:26:15.262699000
2 1970-01-01 00:26:15.262698000
3 1970-01-01 00:26:15.262701000
4 1970-01-01 00:26:15.307111000
...
95 1970-01-01 00:26:16.521124623
96 1970-01-01 00:26:16.521116000
97 1970-01-01 00:26:16.521118000
98 1970-01-01 00:26:16.521145701
99 1970-01-01 00:26:16.521147000
Name: date, Length: 100, dtype: datetime64[ns]
Run Code Online (Sandbox Code Playgroud)
这当然是错误的,知道为什么吗?谢谢!
这是输入的示例:1575262698000.0输出应如下所示:2019-12-02 04:58:18
我当前的数据框如下所示:
midprice ema12 ema26 difference
0 0.002990 0.002990 0.002990 0.000000e+00
1 0.002990 0.002990 0.002990 4.227920e-08
2 0.003018 0.002994 0.002992 2.295777e-06
3 0.003025 0.002999 0.002994 4.579221e-06
4 0.003067 0.003009 0.003000 9.708765e-06
5 0.003112 0.003025 0.003008 1.718520e-05
Run Code Online (Sandbox Code Playgroud)
我尝试的是以下内容:
df.loc[:, 'action'] = np.select(condlist=[df.difference[0] < df.difference[-1] < df.difference[-2], df.ema12 < df.ema26 ], choicelist=['buy', 'sell'], default='do nothing')
因此action,buy如果连续三次更新该列,该列的值difference小于它的先前值。关于如何进行的任何想法?谢谢!
我的请求很简单,但我不知道如何进行:
我想按照以下方式在python中翻译一个except语句:
taken_asks -= 1 unless taken_asks == 0
Run Code Online (Sandbox Code Playgroud)
这只是一行代码,是很大功能的一部分。任何的想法?
先感谢您 !
我的数据框如下所示:
timestamp topAsk topBid CPA midprice CPB spread s
0 2019-03-14 00:00:00 0.00005000 0.00004957 0.00004979 0.00004979 0.00004979 4.3E-7 0.008636272343844145410725045190
1 2019-03-14 00:01:00 0.00005000 0.00004957 0.00004979 0.00004979 0.00004979 4.3E-7 0.008636272343844145410725045190
2 2019-03-14 00:02:00 0.00005000 0.00004957 0.00004979 0.00004979 0.00004979 4.3E-7 0.008636272343844145410725045190
3 2019-03-14 00:03:00 0.00005000 0.00004957 0.00004979 0.00004979 0.00004979 4.3E-7 0.008636272343844145410725045190
4 2019-03-14 00:04:00 0.00005000 0.00004957 0.00004979 0.00004979 0.00004979 4.3E-7 0.008636272343844145410725045190
5 2019-03-14 00:05:00 0.00005000 0.00004957 0.00004979 0.00004979 0.00004979 4.3E-7 0.008636272343844145410725045190
6 2019-03-14 00:06:00 0.00005000 0.00004957 0.00004979 0.00004979 0.00004979 4.3E-7 0.008636272343844145410725045190
7 …Run Code Online (Sandbox Code Playgroud) 我的数据框如下所示:
timestamp price amount amount_f status eth_amount
0 2018-11-30 13:48:00 0.00348016 10 0 cancelled 0.000000
1 2018-11-30 13:48:00 0.00350065 10 0 cancelled 0.000000
2 2018-11-30 13:50:00 0.00348021 10 0 cancelled 0.000000
3 2018-11-30 13:50:00 0.00350064 10 0 cancelled 0.000000
4 2018-11-30 13:51:00 0.00348054 10 0 cancelled 0.000000
5 2018-11-30 13:51:00 0.00349873 10 0 cancelled 0.000000
6 2018-11-30 13:52:00 0.00348094 10 10 filled 0.034809
7 2018-11-30 13:52:00 0.00349692 10 0 cancelled 0.000000
Run Code Online (Sandbox Code Playgroud)
事实上,我需要的是根据列amount和amount_f. 这将是一个 if 语句,如下所示:
df.amount …
我的数据框如下所示:
exp gamma% proba-a% spread-test in %
0 -6.415879 0.100 34.503457 0.1277374979529247122928732004
1 -4.558370 0.200 26.517913 0.1277374979529247122928732004
2 -2.821595 0.300 17.875550 0.1277374979529247122928732004
3 -2.118973 0.400 14.736015 0.1277374979529247122928732004
4 -1.665637 0.500 12.837838 0.1277374979529247122928732004
5 -1.326727 0.600 11.467630 0.1277374979529247122928732004
6 -1.048364 0.700 10.314268 0.1277374979529247122928732004
7 -0.819480 0.800 9.355751 0.1277374979529247122928732004
8 -0.623309 0.900 8.475801 0.1277374979529247122928732004
9 -0.466824 1.000 7.847266 0.1277374979529247122928732004
Run Code Online (Sandbox Code Playgroud)
我想把它写在Excel表中。我尝试过的:
from pandas import ExcelWriter
writer = ExcelWriter('spread32.xlsx')
yourdf.to_excel(writer)
writer.save()
Run Code Online (Sandbox Code Playgroud)
但是excel文件中没有写入任何内容,它仍然是空的。
是因为我使用的是jupyter笔记本吗?Excel 文件已经存在。
我的字符串看起来如下:
'{"book":"xrp_mxn","created_at":"2020-09-14T10:39:07+0000","minor":"-101850.00105195","major":"19705.14850000","fees_amount":"19.70514850","fees_currency":"xrp","minor_currency":"mxn","major_currency":"xrp","oid":"eIWDMLdNXK2Wvqxk","tid":"17970757","price":"5.1687","side":"buy","maker_side":"buy"},{"book":"xrp_mxn","created_at":"2020-09-14T10:34:23+0000","minor":"-1523.99894805","major":"294.85150000","fees_amount":"0.29485150","fees_currency":"xrp","minor_currency":"mxn","major_currency":"xrp","oid":"eIWDMLdNXK2Wvqxk","tid":"17970750","price":"5.1687","side":"buy","maker_side":"buy"},{"book":"xrp_mxn","created_at":"2020-09-14T10:29:55+0000","minor":"-103538.00000000","major":"20000.00000000","fees_amount":"20.00000000","fees_currency":"xrp","minor_currency":"mxn","major_currency":"xrp","oid":"xMSTfJJPydmMsx4a","tid":"17970738","price":"5.1769","side":"buy","maker_side":"buy"},{"book":"btc_mxn","created_at":"2020-09-14T09:37:39+0000","minor":"8947.97959853","major":"-0.04075142","fees_amount":"17.89595920","fees_currency":"mxn","minor_currency":"mxn","major_currency":"btc","oid":"GWNkpxGWGab30YCG","tid":"17970649","price":"219574.67","side":"sell","maker_side":"sell"}'
Run Code Online (Sandbox Code Playgroud)
我尝试执行以下操作将其转换为熊猫数据框:
df = pd.read_csv(data, sep="{}")
df
Run Code Online (Sandbox Code Playgroud)
但基本上我的行只是标题,知道为什么吗?谢谢!
我的代码如下所示:
from pymongo import MongoClient
client = MongoClient()
client = MongoClient('localhost', 27017)
db = client.local
orderbook = db.orderbook_update.find({'lastUpdated': 1538584913932}).limit(1)
for order in orderbook:
timestamp = order['lastUpdated']
timestamp = timestamp - (timestamp%60000)
timestamp_target = timestamp + 60000
orderbook_target = db.orderbook_update.find({'lastUpdated': {'$lt':timestamp_target}}).limit(1)
def to_millis(time):
return int(pd.to_datetime(time).value / 1000000)
print(timestamp_target)
for orderb in orderbook_target:
topAsk = orderb['asks'][0][0]
topBid = orderb['bids'][0][0]
conn = psycopg2.connect("dbname=monty user=postgres host=localhost password=postgres")
cur = conn.cursor()
cur.execute("SELECT * FROM binance.zrxeth_aggregated;")
row = cur.fetchall()
for r in row:
ts = to_millis(r[0]) …Run Code Online (Sandbox Code Playgroud)