from pybit.unified_trading import WebSocket
from pybit.unified_trading import HTTP
from time import sleep
session = HTTP(testnet=False)
info = session.get_instruments_info(category="spot")
symbol_infos = info["result"]["list"]
websockets = []
def handle_message(message):
print(message)
def subscribe(websockets, symbols):
print(f'Subscribing to {symbols}')
ws = WebSocket(
testnet=False,
channel_type="spot",
)
ws.trade_stream(symbol=symbols, callback=handle_message)
websockets += [ws]
Author Archives: dmitriano
Subscribing to all ByBit trade streams in Python
Subscribing to ByBit WebSocket streams in Python
Spot is limited to 10 symbols:
from pybit.unified_trading import WebSocket
from time import sleep
ws = WebSocket(
testnet=True,
channel_type="spot",
)
def handle_message(message):
print(message)
#ws.orderbook_stream(50, "BTCUSDT", handle_message)
ws.ticker_stream(symbol=["BTCUSDT", "ETHUSDT"], callback=handle_message)
while True:
sleep(1)
An example of connecting a signal by name in QT
class TableColumn : public QObject
{
Q_OBJECT
public slots:
void onValueChanged()
{
emit onChanged();
}
signals:
void onChanged();
};
An example of using base iterator in C++
The code below demonstrates how to access underlying range iterator by transformed iterator:
struct A
{
int x;
};
struct B
{
A* a;
};
std::vector<B> v;
int main()
{
auto a_range = v | std::views::transform(std::mem_fn(&B::a));
auto i = std::ranges::find(a_range, 5, std::mem_fn(&A::x));
A* a = *i;
B& b = *(i.base());
}
An example on what ROWID is in SQLite
ROWID is of alias of an integer primary key:
CREATE TABLE test1(id INTEGER, b TEXT, PRIMARY KEY(id))
INSERT INTO test1 (id, b) VALUES (5, 'five');
INSERT INTO test1 (id, b) VALUES (6, 'six');
INSERT INTO test1 (b) VALUES ('seven');
SELECT rowid, * FROM test1;
My first attempt to make a video call with PJSIP
Added video codecs to pjsip.conf:
allow=h263p
allow=h263
allow=h264
allow=vp8
see full PJSIP configuration on GitHub.
core show channeltypes
Type Description Devicestate Presencestate Indications Transfer
------------- ------------- ------------- ------------- ------------- -------------
Recorder Bridge Media Recording Channel Driver no no yes no
Announcer Bridge Media Announcing Channel Driver no no yes no
USTM UNISTIM Channel Driver no no yes no
CBAnn Conference Bridge Announcing Channel no no yes no
CBRec Conference Bridge Recording Channel no no no no
PJSIP PJSIP Channel Driver yes no yes yes
AudioSocket AudioSocket Channel Driver no no no no
UnicastRTP Unicast RTP Media Channel Driver no no no no
MulticastRTP Multicast RTP Paging Channel Driver no no no no
IAX2 Inter Asterisk eXchange Driver (Ver 2) yes no yes yes
Local Local Proxy Channel Driver yes no yes no
Surrogate Surrogate channel used to pull channel f no no no no
----------
12 channel drivers registered.
Further investigation of Asterisk logs
Clients A and B are in Windows Sandboxes behind a router in a local network.
Client A:
Connection-specific DNS Suffix . : mshome.net
Link-local IPv6 Address . . . . . : fe80::db7a:bb9e:748a:f5a9%205
IPv4 Address. . . . . . . . . . . : 172.28.33.149
Subnet Mask . . . . . . . . . . . : 255.255.240.0
Default Gateway . . . . . . . . . : 172.28.32.1
Client B:
Connection-specific DNS Suffix . : mshome.net
Link-local IPv6 Address . . . . . : fe80::d607:36fe:46b0:b7dc%205
IPv4 Address. . . . . . . . . . . : 172.24.106.63
Subnet Mask . . . . . . . . . . . : 255.255.240.0
Default Gateway . . . . . . . . . : 172.24.96.1
How to add a scrollable text block to a WordPress post
With preformatted block
Add the following class to your style.css:
.scrollable-log {
overflow-y: scroll;
font-family: Monaco, "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important;
font-weight: normal !important;
font-style: normal !important;
font-size: 1em !important;
max-height: 400px;
}


