My name is Artur and I am backend engineer by day, web3 enthusiast by night.
Want to get in touch? email me, message me on twitter, or on discord at rtuna.
Wrapper around Binance's Futures Leaderboard API, in Go.
License: MIT License
in your subscriber example how would someone subscribe to multiple IDs in the same instance, is that even possible?
error has occurred: failed to fetch positions: 403 Forbidden
error has occurred: failed to fetch positions: 403 Forbidden
have you run into rate limits before? ive subscribed to 4 and routed to my discord
package main
import (
"context"
"fmt"
"github.com/bwmarrin/discordgo"
"github.com/rtunazzz/bfldb"
"time"
)
func main() {
// Replace YOUR_TOKEN_HERE with your Discord bot's token
dg, err := discordgo.New("Bot " + "")
if err != nil {
fmt.Println("error creating Discord session:", err)
return
}
defer dg.Close()
// Replace CHANNEL_ID_HERE with the ID of the Discord channel where you want to send the message
channelID := ""
// Open a websocket connection to Discord and begin listening.
err = dg.Open()
if err != nil {
fmt.Println("Error opening connection: ", err)
return
}
// You can find this UID (encryptedUid) in the end of a leaderboard profile URL. For example:
// https://www.binance.com/en/futures-activity/leaderboard/user?encryptedUid=47E6D002EBB1173967A6561F72B9395C
u := bfldb.NewUser("F3050271F9F3463B0EED70B412D6436F")
cp, ce := u.SubscribePositions(context.Background())
for {
select {
case position := <-cp:
now := time.Now()
timestamp := now.Format("2006-01-02 15:04:05")
embed := &discordgo.MessageEmbed{
Fields: []*discordgo.MessageEmbedField{
&discordgo.MessageEmbedField{
Name: "Trader",
Value: "kaikai2022\n",
Inline: false,
},
&discordgo.MessageEmbedField{
Name: "Ticker",
Value: position.Ticker,
Inline: true,
},
&discordgo.MessageEmbedField{
Name: "L/S",
Value: position.Direction.String(),
Inline: true,
},
&discordgo.MessageEmbedField{
Name: "Type",
Value: position.Type.String(),
Inline: true,
},
&discordgo.MessageEmbedField{
Name: "EntryPrice",
Value: fmt.Sprintf("%f", position.EntryPrice),
Inline: true,
},
&discordgo.MessageEmbedField{
Name: "Leverage",
Value: fmt.Sprintf("%d", position.Leverage),
Inline: true,
},
&discordgo.MessageEmbedField{
Name: "PnL",
Value: fmt.Sprintf("%f", position.Pnl),
Inline: true,
},
&discordgo.MessageEmbedField{
Name: "Timestamp",
Value: timestamp,
Inline: true,
},
},
}
embed.Color = 10181046
_, _ = dg.ChannelMessageSendEmbed(channelID, embed)
case err := <-ce:
fmt.Println("error has occurred:", err)
break
case <-time.After(time.Second * 100):
fmt.Println("Bot is now running. Press CTRL-C to exit.")
}
}
}
Add a SetDelay
method to the User
struct, that will change the monitoring delay used for the user.
Lines 12 to 21 in 399419e
So we can change the monitoring delay without having to reinitialize User
Hello,
the endpoint /v1/public/future/leaderboard/getOtherPosition is not available anymore, seems the new endpoint is private but some people already found the workaround !
BR
Add a SetHeaders method to the User
struct
Lines 12 to 21 in 399419e
So we can change the user's headers inbetween requests, without having to stop monitoring and reconstruct the User
instance.
Replace the time.NewTicker
and it's relevant usage with time.Sleep
Lines 17 to 44 in 399419e
So we can add a SetDelay
method on the User struct and have a configurable delay without the need of stopping monitoring
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.