domain specific functions for finance and aggregation
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 17.3k
- Forks
- 1.6k
- Avg merge
- 5d 10h
- Merged PRs (30d)
- 28
Description
Is your feature request related to a problem?
Many users of QuestDB are in the finance industry. Within this domain, there are common operations that can be complicated to represent in standard SQL.
We should add functions to make these operations easier for our users, and start with the most common operations.
Such functions should support ARRAY types in future, where useful for performance improvements.
This is a tracking issue, and we welcome suggestions from users!
Describe the solution you'd like.
More domain-specific finance functions around trading and order books.
- l2price: level two order-book price
- vwap: volume-weighted average price
- twap: time-weighted average price
- avg: avg window function, can be used to calculate simple moving average
- vwma: volume-weighted moving average (window)
- Issue: https://github.com/questdb/questdb/issues/4727
- not looking for contributions, some internal work needed
- mid(bid,ask):
average(bid, ask) = bid+ask / 2 - spread(bid, ask):
ask-bid - wmid(bid_size, bid, ask, ask_size): weighted mid point:
wmid = (imbalance * ask_price) + (1 - imbalance) * bid_pricewhereimbalance = bid_size / (bid_size + ask_size)- Issue: https://github.com/questdb/questdb/issues/4800
- PR: https://github.com/questdb/questdb/pull/4801
- spread_bps(bid, ask):
spread(bid,ask)/mid(bid,ask) * 10,000 - format_price(decimal_form, tick_size): treasury price format, decimal to fraction, e.g.
format_price(100.5, 32)= 100-16 - get_price(fraction_form, tick_size): treasury price format, fraction to decimal, e.g.
format_price(100-16, 32)= 100.5
More aggregation functions:
- normalised_perf(column, base_value):
base_value x column[i] / column[0] - regr_slope(y, x): https://duckdb.org/docs/sql/aggregates.html#regr_slopey-x
- regr_intercept(y, x): https://duckdb.org/docs/sql/aggregates.html#regr_intercepty-x
Convenience functions:
- to_bbg(Ø): convert a RIC code to a Bloomberg symbol
- to_ric(Ø): convert a Bloomberg symbol to a RIC code
And similar. Names are flexible!
Aggregation functions should be linked in the finance section where relevant, with an associated finance example.
- GT Join
Describe alternatives you've considered.
No response
Full Name:
Nick Woolmer
Affiliation:
QuestDB
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No file or test entry point is named. Start by reviewing the remaining unchecked functions and their linked issues and pull requests, then confirm which item is still available; done means a specifically scoped function is implemented with its relevant documentation or finance example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql
- Domain
- databases, fintech-quant
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100