Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Histórico de cotizaciones #18

Open
3 tasks
aVolpe opened this issue Oct 11, 2018 · 1 comment
Open
3 tasks

Histórico de cotizaciones #18

aVolpe opened this issue Oct 11, 2018 · 1 comment

Comments

@aVolpe
Copy link
Owner

aVolpe commented Oct 11, 2018

El sistema actual almacena todas las cotizaciones, pero no hay forma de hacer un query (desde el API) para obtener el histórico de las mismas.

Para poder crear visualizaciones interesantes sobre la evolución de las distintas es necesario:

  • Crear un query que obtenga un histórico en un rango de fechas (puede ser por día)
  • Crear un controlador (y repositorio) que maneje el query y su resultado
  • Crear las visualizaciones (propongo https://github.com/chartshq/muze)

@diegocrzt

@aVolpe
Copy link
Owner Author

aVolpe commented Oct 11, 2018

Esta es la query v1:

SELECT 
  p.id AS place_id,
    p.name AS place_name,
    pb.id AS branch_id,
    pb.name AS branch_name,
    qr.date::date AS date,
    round(pb.latitude::numeric, 5) AS branch_lat,
    round(pb.longitude::numeric, 5) AS branch_lng,
    
    qrd.iso_code AS currency,
    MAX(qrd.purchase_price) as purchase_price,
    MAX(qrd.sale_price) as sale_price
    
FROM public.query_response_detail qrd
JOIN public.query_response qr ON qr.id = qrd.query_response_id
JOIN public.place_branch pb ON qr.branch_id = pb.id
JOIN public.place p ON p.id = qr.place_id 
WHERE 
  qrd.purchase_price > 0
AND qrd.sale_price > 0
AND pb.latitude IS NOT NULL
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant