Commit Graph

114 Commits

Author SHA1 Message Date
James Grugett
3b953a7c21
Range limit orders (#655)
* Prototype range limit order UI

* Conditionally show YES or NO max payout

* Range bet executes both bets immediately.

* Validate lowLimitProb < highLimitProb

* Show error if low limit is higher than high limit

* Update range order UI

* Revert "Validate lowLimitProb < highLimitProb"

This reverts commit c261fc2743.

* Revert "Range bet executes both bets immediately."

This reverts commit 30b95d75d9.

* Buy panel only non-limit orders

* Bet choice => outcome

* More iterating on range UI

* betChoice => outcome

* Lighten placeholder text
2022-07-22 00:57:56 -05:00
James Grugett
b6c8390a46 Show order book button even on Quick bet 2022-07-19 15:01:15 -05:00
James Grugett
7feacbd961 Tweak wording 2022-07-16 14:37:03 -05:00
James Grugett
7b6344d976 Order book button opens full table of limit orders in dialog 2022-07-16 14:21:25 -05:00
James Grugett
ec682788e0 Put back old Yes/No bet buttons 2022-07-15 11:03:42 -05:00
James Grugett
f4b7b9efd0 Only show probabilty update with arrow if probability changes 2022-07-13 18:39:32 -05:00
James Grugett
67b3450924 Use quick vs limit bet in mobile dialog 2022-07-13 18:28:33 -05:00
James Grugett
9240cd3d1c Bet panel: Quick vs Limit pill buttons. Also, pill buttons for Yes vs No. 2022-07-13 18:23:36 -05:00
James Grugett
f1eea66588 Show all limit orders in a tab 2022-07-13 12:15:00 -05:00
mantikoros
38aad40569
Simplify bet buttons (#644)
* mono-button bet row

* "bet yes" => "yes"

* prettier
2022-07-12 17:34:10 -05:00
mantikoros
dd9fdc381f track limit orders 2022-07-12 16:55:00 -05:00
mantikoros
24896e44b4 "limit bet" => "limit order" 2022-07-12 16:46:03 -05:00
James Grugett
9b252b93ab Fix fee calculation in bet panel tooltip 2022-07-11 10:54:37 -05:00
James Grugett
99fcfa6be7 Add portfolio filter for limit bets. 2022-07-10 22:15:07 -05:00
James Grugett
9586e81e95 Show limit bets in bets table 2022-07-10 22:07:42 -05:00
Marshall Polaris
4700ceb14c
Refactor some backend-related stuff (#639)
* web/lib/firebase/api-call -> common/api, web/lib/firebase/api

* Reuse `APIError` type in server code

* Reuse `getFunctionUrl` in server code
2022-07-10 15:03:15 -07:00
James Grugett
80ae551ca9
🧾 Limit orders! (#495)
* Simple limit order UI

* Update bet schema

* Restrict bet panel / bet row to only CPMMBinaryContracts (all binary DPM are resolved)

* Limit orders partway implemented

* Update follow leaderboard copy

* Change cpmm code to take some state instead of whole contract

* Write more of matching algorithm

* Fill in more of placebet

* Use client side contract search for emulator

* More correct matching

* Merge branch 'main' into limit-orders

* Some cleanup

* Listen for unfilled bets in bet panel. Calculate how the probability moves based on open limit orders.

* Simpler switching between bet & limit bet.

* Render your open bets (unfilled limit orders)

* Cancel bet endpoint.

* Fix build error

* Rename open bets to limit bets. Tweak payout calculation

* Limit probability selector to 1-99

* Deduct user balance only on each fill. Store orderAmount of bet. Timestamp of fills.

* Use floating equal to check if have shares

* Add limit order switcher to mobile bet dialog

* Support limit orders on numeric markets

* Allow CORS exception for Vercel deployments

* Remove console.logs

* Update user balance by new bet amount

* Tweak vercel cors

* Try another regexp for vercel cors

* Test another vercel regex

* Slight notifications refactor

* Fix docs edit link (#624)

* Fix docs edit link

* Update github links

* Small groups UX changes

* Groups UX on mobile

* Leaderboards => Rankings on groups

* Unused vars

* create: remove automatic setting of log scale

* Use react-query to cache notifications (#625)

* Use react-query to cache notifications

* Fix imports

* Cleanup

* Limit unseen notifs query

* Catch the bounced query

* Don't use interval

* Unused var

* Avoid flash of page nav

* Give notification question priority & 2 lines

* Right justify timestamps

* Rewording

* Margin

* Simplify error msg

* Be explicit about limit for unseen notifs

* Pass limit > 0

* Remove category filters

* Remove category selector references

* Track notification clicks

* Analyze tab usage

* Bold more on new group chats

* Add API route for listing a bets by user (#567)

* Add API route for getting a user's bets

* Refactor bets API to use /bets

* Update /markets to use zod validation

* Update docs

* Clone missing indexes from firestore

* Minor notif spacing adjustments

* Enable tipping on group chats w/ notif (#629)

* Tweak cors regex for vercel

* Your limit bets

* Implement selling shares

* Merge branch 'main' into limit-orders

* Fix lint

* Move binary search to util file

* Add note that there might be closed form

* Add tooltip to explain limit probability

* Tweak

* Cancel your limit orders if you run out of money

* Don't show amount error in probability input

* Require limit prob to be >= .1% and <= 99.9%

* Fix focus input bug

* Simplify mobile betting dialog

* Move mobile limit bets list into bet dialog.

* Small fixes to existing sell shares client

* Lint

* Refactor useSaveShares to actually read from localStorage, use less bug-prone interface.

* Fix NaN error

* Remove TODO

* Simple bet fill notification

* Tweak wording

* Sort limit bets by limit prob

* Padding on limit bets

* Match header size

Co-authored-by: Ian Philips <iansphilips@gmail.com>
Co-authored-by: ahalekelly <ahalekelly@gmail.com>
Co-authored-by: mantikoros <sgrugett@gmail.com>
Co-authored-by: Ben Congdon <ben@congdon.dev>
Co-authored-by: Austin Chen <akrolsmir@gmail.com>
2022-07-10 13:05:44 -05:00
mantikoros
50c5f8b6eb reenable fees on share sales; rename getCpmmFees() 2022-07-08 12:34:16 -04:00
mantikoros
1a6afaf44f
Pseudo numeric market (#609)
* create pseudo-numeric contracts

* graph and bet panel for pseudo numeric

* pseudo numeric market layout, quick betting

* Estimated value

* sell panel

* fix graph

* pseudo numeric resolution

* bets tab

* redemption for pseudo numeric markets

* create log scale market, validation

* log scale

* create: initial value can't be min or max

* don't allow log scale for ranges with negative values (b/c of problem with graph library)

* prettier delenda est

* graph: handle min value of zero

* bet labeling

* validation

* prettier

* pseudo numeric embeds

* update disclaimer

* validation

* validation
2022-07-02 14:37:59 -05:00
mantikoros
7679849c7d show 2 decimal places for fees 2022-06-17 16:28:25 -05:00
mantikoros
38c63fb3ee
Amplitude (#505)
* basic amplitude setup

* delete heap

* track referrers

* basic tracking

* delete unused import

* prettier
2022-06-14 22:00:36 -05:00
mantikoros
e28dfaaa80 fix ios scrolling in bet panel 2022-06-10 11:36:07 -05:00
Marshall Polaris
60e830974e
Migrate sellShares cloud function to v2 sellshares (#440)
* Migrate `sellShares` to v2 `sellshares`

* Point client at new v2 sellshares function

* Clean up `getCpmmSellBetInfo`
2022-06-07 13:54:58 -07:00
Marshall Polaris
d9eb9798e5
Point client at new v2 versions of createmarket and placebet (#433)
* Kill 'warmup spam' for createContract and placeBet

* Point v2 function calls at v2 endpoints

* Add real prod placebet and createmarket endpoints
2022-06-06 12:46:06 -07:00
Marshall Polaris
7c4ec2a8e3
Refactor contract typing to be more concise and more correct (#355)
* Refactor contract types slightly

* Refactor contract types greatly

* Kill dead binary DPM contract creation code

* Use BinaryContract, DPMContract, etc. type aliases
2022-05-31 19:42:35 -07:00
Forrest Wolf
c5763e6ec3
Extract signup prompt (#333)
* Extract SignUpPrompt component

* Return null instead of false when not showing SignUpPrompt

* Add trailing newline

* Lint
2022-05-25 09:25:39 -07:00
Marshall Polaris
47f10301c8
Change lodash stuff so that it can be tree-shaken out of build (#233)
* Set common package.json sideEffects: false

* Configure SWC to modularize lodash imports

* Import specific lodash functions instead of _

* Add an eslint rule to avoid full lodash import
2022-05-22 01:36:05 -07:00
Marshall Polaris
20f4b97d8b
Rewrite client for new public APIs to use fetch instead of callables (#241)
* Rename `lib/firebase/api-call` -> `lib/firebase/fn-call`

This relieves ambiguity now that we will be using our actual
public API in the client.

* Rewrite client API calls to createContract, placeBet

* Tiny fixup for client market creation code
2022-05-19 15:04:34 -07:00
Sinclair Chen
f8601af45c
Bet embed (#204)
* Add bet buttons to embed

- Make only title link to market
- Prevent avatar / username from being clicked on

* refactor: remove extra elem, de-indent

* adjust embed info row styles

* make bet panel smaller

* make sell panel smaller
2022-05-17 10:31:19 -07:00
Marshall Polaris
cd7efb03ca
Implement onRequest versions of createContract, placeBet functions (#227)
* Reimplement createContract and placeBet cloud functions

* Fix broken warmup function error handling
2022-05-16 21:43:40 -07:00
Marshall Polaris
aafd2a226f
Clean up some stuff with SellPanel and AmountInput (#232)
* Hoist SellAmountInput logic into SellPanel

* Ditch now-unnecessary SellAmountInput

* Clean up sale proceeds markup

* Clean unused imports

* BuyPanel doesn't need userBets
2022-05-16 20:27:37 -07:00
Marshall Polaris
ee91a94466
Clean up some bet panel markup and CSS (#231)
* Tidy up probability change markup

* Tidy up payout markup
2022-05-15 14:10:26 -07:00
Marshall Polaris
1063897c7c
Clean up extra wrapper and CSS on BetRow (#178) 2022-05-11 14:35:50 -07:00
mantikoros
ef43e46153 include fees in tooltip 2022-05-09 17:33:24 -04:00
Marshall Polaris
acc9c84e2e
More absolute imports (#156)
* Configure functions module to allow absolute imports

* Convert common imports in functions to be absolute

* Convert common imports in web to be absolute

* Convert lib imports in web to be absolute

* Convert hooks imports in web to be absolute

* Convert components imports in web to be absolute
2022-05-09 09:04:36 -04:00
Austin Chen
cea9422802 Update site copy 2022-05-07 10:10:25 -04:00
mantikoros
95b67c05e2 another sell shares rounding bug 2022-05-04 11:47:45 -04:00
James Grugett
6232284e92 Larger font on amount input 2022-05-02 12:15:00 -04:00
Boa
9ba7c04524
Sell shares mobile (#86)
* Abstract sell shares row to component

* Allow sell row to show just a button

This is nice for the feed and on a bet's mobile interface.

* Add and use floor shares

* Allow sell button on the same line as bet button

* Move use save shares to own file

* Make sure to sell non-integer shares

* Create SellButon & sell non-integer shares

* Remove props prefixes

* Break out sell modal and button
2022-04-20 08:13:39 -06:00
James Grugett
24a9a79f16 Decrease padding so sell shares label fits in one line 2022-04-19 12:53:04 -05:00
James Grugett
9c74f88b4a
Improve Free response UI (#78)
* Add legend to free response graph

* Hide answers panel unless resolving. Correctly order answers

* No gray background for add answer & resolve panel. Tweak spacing

* Max answer length 240 chars

* Show answer text in resolution for market page, card instead of number.

* Remove remaining answer #'s. Refactor outcome/resolution labels.

* Move answer panel back up

* Tweak spacing

* Update placement of bet button on mobile for FR answer feed item

* Fix reversed feed for binary markets

* Show multi resolve options

* Clean up unused parts of answer item

* Lighten resolve buttons

* Show answer text in market resolve email
2022-04-18 18:02:40 -05:00
James Grugett
75b39cbf6f Remove loans: no new loans 2022-04-13 12:52:12 -05:00
mantikoros
13300326fd bet panel styling 2022-04-09 16:26:43 -05:00
mantikoros
b624ec045e "buy" => "bet" 2022-04-09 16:13:36 -05:00
James Grugett
1ec8fc5b45 Deemphasize sign in button on sidebar. Change bet panel to use 'sign up' wording. 2022-04-04 00:58:56 -05:00
James Grugett
3eb0bb1711 Throw error if sell conditions don't hold 2022-03-29 21:30:04 -05:00
James Grugett
ed5f69db7a
Sell shares panel (#69)
* Split BuyAmountInput out of AmountInput

* Buy and sell tabs. Compute some sell info

* In progress

* BuyPanel & SellPanel with banner above that shows current shares and toggle button

* Remove "Remaining balance"

* Bring back 'Place a trade'. Tweaks

* Sell shares cloud function.

* Sell all shares by default. Switch back to buy if sell all your shares.

* Cache your shares in local storage so sell banner doesn't flicker.

* Compute sale value of shares with binary search to keep k constant.

* Update bets table to show BUY or SELL

* Fixes from Stephen's review

* Don't allow selling more than max shares in cloud function

* Use modal for sell shares on desktop.

* Handle floating point precision in max shares you can sell.
2022-03-29 14:56:56 -05:00
James Grugett
7696dd84b5 Fix 'undefined' shares in DPM tooltip 2022-03-23 00:40:05 -05:00
James Grugett
cc0beb4ca4 DPM: label payout 'Estimated' in bet panel 2022-03-22 00:18:08 -05:00
Austin Chen
d6a751d9a2 Show decimals on 98%+ 2022-03-18 20:02:04 -07:00