Comments (10)
So what I got for now on my branch after letting it run over the night.
A prediction win will show that we got back 1521
points, with a difference of 275
(won - placed)
02/02 10:29:22 - π EventPrediction: xxx? - Result: WIN, Points won: 1k, Diff: 383
Though I can't find a good name for the diff
π .
A prediction that is a loss is basically the same except that the points won are... well... negative
02/02 10:34:45 - π EventPrediction: xxx? - Result: LOSE, Points won: 0, Diff: -1k
When a refund happens this is where it's a bit shady:
02/02/21 01:04:48 - INFO - TwitchChannelPointsMiner.classes.WebSocketsPool - [on_message]: π +216 β itsspoit (2.167 points) - Reason: REFUND.
02/02/21 01:04:48 - INFO - TwitchChannelPointsMiner.classes.WebSocketsPool - [on_message]: π EventPrediction: Will they win? - Result: REFUND, Points won: 0, Diff: -216
Here the 2 events are separated. The 216
is a refund by itself, while the prediction just showed that we lost whatever we placed.
As you suggested we could somehow merge the 2 messages together and interpret it as being the refund of the bet. Now I don't really know how to do that. The on_message
method seem to take messages one by one, so we can't really do any comparison between messages.
As for the summary part this looks like it for now.
The easiest is when there's no refund:
02/02/21 08:38:18 - INFO - TwitchChannelPointsMiner.TwitchChannelPointsMiner - [__print_report]: π€ Streamer(username=kinggeorge, channel_id=117379932, channel_points=12.471), Total Points Gained (after farming - before farming): 709
02/02/21 08:38:18 - INFO - TwitchChannelPointsMiner.TwitchChannelPointsMiner - [__print_report]: π° WATCH(42 times, 420 gained), WATCH_STREAK(1 times, 450 gained), CLAIM(14 times, 700 gained), PREDICTION(7 times, -861 gained)
If we sum up everything we get back to 709 π
With a refund:
02/02/21 08:38:18 - INFO - TwitchChannelPointsMiner.TwitchChannelPointsMiner - [__print_report]: π€ Streamer(username=itsspoit, channel_id=144516280, channel_points=2.187), Total Points Gained (after farming - before farming): 121
02/02/21 08:38:18 - INFO - TwitchChannelPointsMiner.TwitchChannelPointsMiner - [__print_report]: π° WATCH(2 times, 20 gained), CLAIM(1 times, 50 gained), PREDICTION(3 times, -165 gained), REFUND(1 times, 216 gained)
Again summing up everything we get the right sum. Just that the refund is in a separate category.
Personally I think it's still quite understandable that way. But of course if we can do the merging of the refund messages then it'd be even better.
Also the number of times a prediction happens is different, and I think the reason for that is that now a refund will be counted as a prediction where we lost x points. So to me it makes sense to keep it that way.
from twitch-channel-points-miner-v2.
I'm totally agreed with you, I'll as soon as possible.
Or if you want to submit a pull request, you are welcome!
The first idea It's fine but for have a perfect report we should also remove the REFUND
sections and simply write:
PREDICTION(10 times, (won - placed + refund) gained)
and the times should be equal to prediction-made.
Most of the time I've (after farming - before farming) < 0
, but I don't know why or where I have lost my points π
from twitch-channel-points-miner-v2.
Merging REFUND completely with the predictions can lead to false results (maybe). The sources of this can be multiple:
- A prediction has been cancelled
- You bought something with the channel points and it has been refunded to you
I don't really know the "api" or the data you get from twitch, but if the refund takes into account both cases then we'll have to be careful.
Or maybe the coded REFUND only applies to prediction refunds?
from twitch-channel-points-miner-v2.
As an info I checked the REFUND
and it is also fired when something bought with channel points is refunded.
So maybe it is a better idea to keep it separated for now or find a way to distinguish it from refunds from predictions.
from twitch-channel-points-miner-v2.
I need to check in my logs if with the REFUND
status we have also the event_id
.
Maybe this can help us to understand if the REFUND
It's related to a prediction or not.
We can also check if we have a refund after the event cancelled.
For example If the event 0000 was deleted and after that we have a REFUND of x channel points - the same points place on the event 0000 - we know that the two event are correlated.
from twitch-channel-points-miner-v2.
I don't think REFUND is linked to predictions as it's in the community-points-user-v1
part and basically lists the reasons why you get points.
Now, we can get the info that it is a refund from a prediction in the predictions-user-v1
part.
For now I just try things on a forked branch, logging what seems interesting and will see if anything comes out of it.
What is a bit of a burden is that the update of the streamer history is always done in the community-points-user-v1
part. I wonder if it wouldn't be easier to also copy that part into the predictions so that we have better control of it. Of course we'd have to not update the streamer history if the type of update is prediction related. Though in the predictions-user-v1
we'd have better control of the update and can update the history with always the PREDICTION
type (so it mixes prediction results/refunds) and value:
- If the prediction is a WIN/LOSE then the points won are
won - placed
. - If a prediction is cancelled, then the points won are
0
, or we could even not count that bet at all.
Now with that comes another problem (which is essentially the same as before), how do we filter out the predictions refunds from community-points-user-v1
.
from twitch-channel-points-miner-v2.
Awesome! Thanks for your contribution π₯³
Here all the messages π
Message 0
{
"type":"MESSAGE",
"data":{
"topic":"community-points-user-v1.0000000",
"message":{
"type":"points-spent",
"data":{
"timestamp":"2021-01-22T14:01:11.954376605Z",
"balance":{
"user_id":"0000000",
"channel_id":"*******",
"balance":60158
}
}
}
}
}
Message 1
{
"type":"MESSAGE",
"data":{
"topic":"community-points-user-v1.0000000",
"message":{
"type":"points-earned",
"data":{
"timestamp":"2021-01-22T13:59:52.917057178Z",
"channel_id":"*******",
"point_gain":{
"user_id":"0000000",
"channel_id":"*******",
"total_points":4522,
"baseline_points":4522,
"reason_code":"REFUND",
"multipliers":[
]
},
"balance":{
"user_id":"0000000",
"channel_id":"*******",
"balance":64686
}
}
}
}
}
Message 2
{
"type":"MESSAGE",
"data":{
"topic":"predictions-user-v1.0000000",
"message":{
"type":"prediction-result",
"data":{
"timestamp":"2021-01-22T13:59:52.922967445Z",
"prediction":{
"id":"a1d58cc540ff732a7442626676b609d93c8ff89d6092e756c817708588dc7697",
"event_id":"dd6066bd-8ace-4cae-b3d1-e136c5a69706",
"outcome_id":"b64ed86c-ab1a-44fc-b6d8-f59a39637087",
"channel_id":"*******",
"points":4522,
"predicted_at":"2021-01-22T13:49:55.146374343Z",
"updated_at":"2021-01-22T13:59:52.919010766Z",
"user_id":"0000000",
"result":{
"type":"REFUND",
"points_won":null,
"is_acknowledged":false
},
"user_display_name":null
}
}
}
}
}
This is should be the condition for link the two events
message1.type == "points-earned"
and message2.type == "prediction-result"
and message1.data.point_gain.reason_code == "REFUND"
and message2.prediction.result.type == "REFUND"
and message2.prediction.points == message1.data.point_gain.total_points
from twitch-channel-points-miner-v2.
Though I can't find a good name for the diff π .
Maybe gained
?
A prediction that is a loss is basically the same except that the points won are... well... negative
I'm currently working a little f/e with apexcharts.js
and I'm currently recording all the community-points-user-v1
.
I've the idea also to write points annotation when a Bet It's WON
or LOSE
.
Here an example (please don't look at the red squared -- / -0, It's an error).
But the idea It's to use:
03/02/21 02:47:28 - π EventPrediction(event_id=xxxxxx, title=ONE) - Result: WIN, Points won: +2.32k
03/02/21 11:50:36 - π EventPrediction(event_id=xxxxxx, title=TWO) - Result: LOSE, Points won: -2k
Maybe we don't really need the diff
and we can use only Points won: +/-
The problem It's also with this I've a -
on points won in REFUND
case
03/02/21 00:06:16 - π EventPrediction(event_id=c3a3acf9-5575-4b76-b1b6-c2686f776b43, title=vincerΓ homyatol?) - Result: REFUND, Points won: --2k
But we can easily handle this by change the condition:
points_prefix = (
"+" if event_result["points_won"] or event_result['type'] == "REFUND" else "-"
)
About the main topic of this issue:
We have always a message from community-points-user-v1 -> points-earned -> REFUND
and after this a message from predictions-user-v1 -> prediction-result -> REFUND
We can do the following:
ON (community-points-user-v1 -> points-earned -> REFUND):
ws.streamers[streamer_index].update_history(reason_code, earned)
# So in this case nothing change.
ON(predictions-user-v1 -> prediction-result -> REFUND):
ws.streamers[streamer_index].history["REFUND"]["counter"] -= 1
ws.streamers[streamer_index].history["REFUND"]["amount"] -= bet-placed
from twitch-channel-points-miner-v2.
Yeah I saw a bit what you did in the other branch. It is interesting and of course can be used that way along with the last block in your comment above.
So to sum it up, assuming the analytics branch is merged first, what this issue would mean is:
- Move the update of the history for the predictions from the community-points to the prediction-user (this allow us to perform the
earned-placed
or 0 for refund) - When a refund of a prediction is made, subtract a refund from the history and count it as a bet with 0 of reward.
I'll do the changes that way in my branch so I can let it run a bit and see if it leads to problems white the analytics branch moves forward.
from twitch-channel-points-miner-v2.
Yup. Work on your branch, and I'll wait for the PR π₯³
I think the analytics branch will be merged in the future, we have currently issues more important
from twitch-channel-points-miner-v2.
Related Issues (20)
- Login_Flow error
- Script prompts to authorize tv after reboot
- Function "login_flow_backup()" or multi accounts HOT 2
- Crashing HOT 1
- ModuleNotFoundError HOT 1
- Replit Deployment
- Drops
- TwitchAPI error code (5023) during the login flow. HOT 1
- error
- OUTDATED REPO
- Raspberry pi numpy HOT 2
- days_ago being to high causes analytics to break (#FirstIssue)
- The problem with using the miner HOT 3
- getting error in termux HOT 1
- idk how to fix this
- help me please !! HOT 2
- This work? HOT 1
- only works when i'm actually watching the stream HOT 1
- docker - code not updated? HOT 1
- Termux doesn't work HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from twitch-channel-points-miner-v2.