Closed ajlacey closed 2 months ago
@pwdel what is the distinction we're making between Market.ResolutionDateTime and Market.FinalResolutionDateTime? Is the former indicating a scheduled close and the ladder indicating an early close? If so, I think we can consolidate them into a single field.
That said, it looks like the ResolveMarkethandler only sets the FinalResolutionDateTime field, but we check the ResolutionDateTime field to see if a market is still open.
I put this on Discord but also putting it here for reference.
Is there a way to insert these descriptions into the model in Golang or reduced versions of these to be more explicit?
ID (int64):
The unique identifier for each market, serving as the primary key in the database.
QuestionTitle (string):
The main question or statement that the market is predicting, which users will bet on.
Description (string):
A detailed explanation of the market, providing context, rules, and any other relevant information.
OutcomeType (string):
Specifies the type of outcome the market is based on. Currently, only Yes/No categorical outcomes are supported.
ResolutionDateTime (time.Time):
The scheduled date and time when the market's outcome will be determined.
FinalResolutionDateTime (time.Time):
The actual date and time when the market was resolved, regardless of the originally scheduled resolution date.
UTCOffset (int):
The offset from Coordinated Universal Time (UTC) for the market's time zone, indicating the local time zone difference.
IsResolved (bool):
A flag indicating whether the market has been resolved (true) or is still open for trading (false).
ResolutionResult (string):
The final outcome or result of the market, typically recorded after the resolution date, such as "Yes," "No," or another specified result.
InitialProbability (float64):
The initial probability assigned to the market's outcome at the time of its creation, representing the starting point for betting.
CreatorUsername (string):
The username of the user who created the market, linking the market to its creator.
Creator (User):
A reference to the User struct, establishing a relationship between the market and its creator based on the CreatorUsername.
@ajlacey got the following backend error when attempting to run this branch.
It seems that we need to modify the public response type for the market.
Likely this will effect the front end.
As far as I can tell via a search in VSCode, this function is used in:
Some of the above functions may make use of the ResolutionDateTime field and we will have to percolate our changes up through into the frontend.
The server has those functions listed at:
https://github.com/openpredictionmarkets/socialpredict/blob/main/backend/server/server.go
We can search those functions in the front end by for example searching:
v0/markets/
Which brings up for example BetsActivity.jsx
, used as follows:
const BetsActivityLayout = ({ marketId }) => {
const [bets, setBets] = useState([]);
useEffect(() => {
const fetchBets = async () => {
const response = await fetch(`${API_URL}/api/v0/markets/bets/${marketId}`, {
});
if (response.ok) {
const data = await response.json();
setBets(data.sort((a, b) => new Date(b.placedAt) - new Date(a.placedAt)));
} else {
console.error('Error fetching bets:', response.statusText);
}
};
fetchBets();
}, [marketId]);
Though that specific field doesn't seem to be used in the front end here on that function.
However, I found where this field is used in the frontend by searching, resolutiondatetime
... and see that it's used under MarketDetailsLayout.jsx
here:
{[
{ label: 'Users', value: `${numUsers}`, icon: '👤' },
{ label: 'Volume', value: `${totalVolume.toFixed(2)}`, icon: '📊' },
{ label: 'Comments', value: '0', icon: '💬' },
{
label: 'Closes',
value: market.isResolved
? 'Closed'
: formatResolutionDate(market.resolutionDateTime),
icon: '📅',
},
So, also that field, isResolved
is being used, so we would hypothetically need to change that to, isClosed
per what you are suggesting and then the resolutionDateTime
would need to be re-instated to where it can be reported again.
I'm realizing that perhaps the entire logic is confusing and maybe we need to document what we want the outcome to be first.
Error below.
socialpredict-backend-container | Setting up watches. Beware: since -r was given, this may take a while!
socialpredict-backend-container | Watches established.
socialpredict-backend-container | # socialpredict/handlers/marketpublicresponse
socialpredict-backend-container | handlers/marketpublicresponse/publicresponsemarket.go:47:35: market.ResolutionDateTime undefined (type models.Market has no field or method ResolutionDateTime)
socialpredict-backend-container | # socialpredict/handlers/marketpublicresponse
socialpredict-backend-container | handlers/marketpublicresponse/publicresponsemarket.go:47:35: market.ResolutionDateTime undefined (type models.Market has no field or method ResolutionDateTime)
socialpredict-backend-container | # socialpredict/handlers/marketpublicresponse
socialpredict-backend-container | handlers/marketpublicresponse/publicresponsemarket.go:47:35: market.ResolutionDateTime undefined (type models.Market has no field or method ResolutionDateTime)
@pwdel what is the distinction we're making between Market.ResolutionDateTime and Market.FinalResolutionDateTime? Is the former indicating a scheduled close and the ladder indicating an early close? If so, I think we can consolidate them into a single field.
That said, it looks like the ResolveMarkethandler only sets the FinalResolutionDateTime field, but we check the ResolutionDateTime field to see if a market is still open.