![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
bitcom-python-api is a lightweight Python library for bit.com API, supporting Rest requests and event streaming using Websocket.
API Doc
https://www.bit.com/docs/en-us/#introduction
Prerequisite
Install package
pip3 install bitcom
Host
You can get the latest production/testnet hosts here, including REST API and WebSocket.
https://www.bit.com/docs/en-us/#api-hosts-production
Rest public client example
from bitcom.client.market_client import MarketClient
from bitcom.utils import *
from bitcom.constant import *
market_client = MarketClient(url=USER1_HOST)
param_map = {
'instrument_id': 'BTC-PERPETUAL',
}
funding_rate_response = market_client.get_funding_rate(param_map)
LogInfo.output("Get funding rate: ", funding_rate_response)
Rest private client example
from bitcom.client.order_client import OrderClient
order_client = OrderClient(url=USER1_HOST, access_key='<your-access-key>', secret_key='<your-secret-key>')
ret = order_client.place_new_order({
'instrument_id': 'BTC-PERPETUAL',
'qty': '1500',
'side': 'buy',
'order_type': 'market',
})
print(ret)
Websocket subscribe example
from bitcom.client.ws_auth_client import WsAuthClient
from bitcom.client.subscribe_client import SubscribeClient
from bitcom.utils import *
from bitcom.constant import *
import json
import time
ws_client = WsAuthClient(url=USER1_HOST, access_key=USER1_ACCESS_KEY, secret_key=USER1_SECRET_KEY)
token_response = ws_client.get_ws_auth_token()
LogInfo.output("Get websocket token: ", token_response)
def on_wss_open(ws):
cmd = {"type": "subscribe", "instruments": ["BTC-PERPETUAL"],
"channels": ["ticker"], "interval": "raw", "token": "{your_token}"}
# convert to string
cmdStr = json.dumps(cmd)
print('send subscribe cmd: ' + cmdStr)
ws.send(cmdStr)
def on_wss_msg(ws, data):
print(data)
channel = SubscribeClient(WS_HOST, on_wss_open, on_wss_msg)
channel.start()
time.sleep(3)
FAQs
bitcom-python-api is a lightweight Python library for bit.com API, supporting Rest requests and event streaming using Websocket.
We found that bitcom demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.