[fusion_builder_container hundred_percent=”no” equal_height_columns=”no” menu_anchor=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” class=”” id=”” background_color=”” background_image=”” background_position=”center center” background_repeat=”no-repeat” fade=”no” background_parallax=”none” parallax_speed=”0.3″ video_mp4=”” video_webm=”” video_ogv=”” video_url=”” video_aspect_ratio=”16:9″ video_loop=”yes” video_mute=”yes” overlay_color=”” video_preview_image=”” border_size=”” border_color=”” border_style=”solid” padding_top=”” padding_bottom=”” padding_left=”” padding_right=”” margin_bottom=”50″][fusion_builder_row][fusion_builder_column type=”1_1″ type=”1_1″ background_position=”left top” background_color=”” border_size=”” border_color=”” border_style=”solid” border_position=”all” spacing=”yes” background_image=”” background_repeat=”no-repeat” padding_top=”” padding_right=”” padding_bottom=”” padding_left=”” margin_top=”0px” margin_bottom=”0px” class=”” id=”” animation_type=”” animation_speed=”0.3″ animation_direction=”left” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” center_content=”no” last=”true” min_height=”” hover_type=”none” link=”” first=”true”][fusion_imageframe image_id=”12445|full” max_width=”” style_type=”” blur=”” stylecolor=”” hover_type=”none” bordersize=”” bordercolor=”” borderradius=”” align=”none” lightbox=”no” gallery_id=”” lightbox_image=”” lightbox_image_id=”” alt=”” link=”” linktarget=”_self” animation_type=”” animation_direction=”left” animation_speed=”0.3″ animation_offset=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” class=”” id=”” filter_hue=”0″ filter_saturation=”100″ filter_brightness=”100″ filter_contrast=”100″ filter_invert=”0″ filter_sepia=”0″ filter_opacity=”100″ filter_blur=”0″ filter_hue_hover=”0″ filter_saturation_hover=”100″ filter_brightness_hover=”100″ filter_contrast_hover=”100″ filter_invert_hover=”0″ filter_sepia_hover=”0″ filter_opacity_hover=”100″ filter_blur_hover=”0″]https://www.investireinvino.it/wp-content/uploads/2021/12/Schermata-2021-12-23-alle-10.26.31-2-2-1-1-1-1.png[/fusion_imageframe][/fusion_builder_column][/fusion_builder_row][/fusion_builder_container][fusion_builder_container hundred_percent=”no” equal_height_columns=”no” menu_anchor=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” class=”” id=”” background_color=”” background_image=”” background_position=”center center” background_repeat=”no-repeat” fade=”no” background_parallax=”none” parallax_speed=”0.3″ video_mp4=”” video_webm=”” video_ogv=”” video_url=”” video_aspect_ratio=”16:9″ video_loop=”yes” video_mute=”yes” overlay_color=”” video_preview_image=”” border_size=”” border_color=”” border_style=”solid” padding_top=”” padding_bottom=”” padding_left=”” padding_right=””][fusion_builder_row][fusion_builder_column type=”1_1″ type=”1_1″ background_position=”left top” background_color=”” border_size=”” border_color=”” border_style=”solid” border_position=”all” spacing=”yes” background_image=”” background_repeat=”no-repeat” padding_top=”” padding_right=”” padding_bottom=”” padding_left=”” margin_top=”0px” margin_bottom=”0px” class=”” id=”” animation_type=”” animation_speed=”0.3″ animation_direction=”left” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” center_content=”no” last=”true” min_height=”” hover_type=”none” link=”” first=”true”][fusion_text]Credo sia utile pubblicare di volta in volta qualche caso studio per aiutare a capire meglio i reali prezzi di vendita e il rendimento degli investimenti in vini pregiati.
Soprattutto se si tratta di uno di quegli investimenti anomali nelle tempistiche o con vini particolari, come in questo caso.
Il nostro sig. “Rossi” (per privacy non possiamo ovviamente rivelare il nome) investe 20.052€ su Londra nel luglio 2020.
Quale che settimana fa decide di vendere e quindi ci mettiamo al lavoro per trovare i possibili acquirenti.
Sicuramente sarebbe stato necessario attendere ancora per ottimizzare i guadagni perché 18 mesi nell‘investimento in vini pregiati sono troppo pochi ma la necessità era quella e quindi cerchiamo di fare il meglio.
Dopo tre settimane di lavoro troviamo gli acquirenti per vendere i vini e procediamo alla vendita.
Dalla vendita totale otteniamo 22.650€, il costo dello stoccaggio è stato di euro 702,57€ e, se anche volessimo calcolare come costo, i 248€ di abbonamento alla nostra piattaforma sostenuti in quel lasso di tempo (calcolo errato perché il nostro è un servizio non imputabile solo ai vini acquistati, ma anche alla conoscenza personale in tema di investimento in vino), il guadagno finale è stato di euro 1647,43€ ossia 11,47% sul periodo. Per semplificarvi meglio il calcolo si parla di un 8% annuo di rendimento.[/fusion_text][fusion_tagline_box backgroundcolor=”” shadow=”no” shadowopacity=”0.7″ border=”1″ bordercolor=”” highlightposition=”left” content_alignment=”center” link=”” button=”” linktarget=”_self” modal=”” button_size=”” button_type=”” button_border_radius=”” buttoncolor=”default” title=”UmljYXBpdG9saWFtbw==” description=”IA==” animation_type=”” animation_direction=”left” animation_speed=”0.3″ animation_offset=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” class=”” id=””]
Costo delle bottiglie: 20.052€
Costo di Stoccaggio: 702,57€
Costo Abbonamento: 248€
Totale investimento: 21.002,57€
Totale ricavato dalla rivendita: 22.650€
Guadagno (in poco meno di 18 mesi): 1647,43€
[/fusion_tagline_box][/fusion_builder_column][/fusion_builder_row][/fusion_builder_container][fusion_builder_container hundred_percent=”no” equal_height_columns=”no” menu_anchor=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” class=”” id=”” background_color=”” background_image=”” background_position=”center center” background_repeat=”no-repeat” fade=”no” background_parallax=”none” parallax_speed=”0.3″ video_mp4=”” video_webm=”” video_ogv=”” video_url=”” video_aspect_ratio=”16:9″ video_loop=”yes” video_mute=”yes” overlay_color=”” video_preview_image=”” border_size=”” border_color=”” border_style=”solid” padding_top=”” padding_bottom=”” padding_left=”” padding_right=””][fusion_builder_row][fusion_builder_column type=”1_1″ type=”1_1″ background_position=”left top” background_color=”” border_size=”” border_color=”” border_style=”solid” border_position=”all” spacing=”yes” background_image=”” background_repeat=”no-repeat” padding_top=”” padding_right=”” padding_bottom=”” padding_left=”” margin_top=”0px” margin_bottom=”0px” class=”” id=”” animation_type=”” animation_speed=”0.3″ animation_direction=”left” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” center_content=”no” last=”true” min_height=”” hover_type=”none” link=”” first=”true”][fusion_text]
Ci tengo a precisare che da questo caso specifico possiamo dedurre tre considerazioni interessanti:
- 18 mesi sono stati pochi, ma talora può capitare che su Londra si possa guadagnare ugualmente anche nel breve termine, anche se non bisogna assolutamente prendere questo comportamento come “virtuoso”
- il costo di stoccaggio su Londra anche se viene calcolato in parte anche sui mesi di stoccaggio tuttavia é “proporzionalmente” più alto nel breve termine. Tenete costo che sui 5 anni il costo di stoccaggio sarebbe stato di poco superiore ai 2.000€ (2.041€)
- calcolando il periodo covid e tutti quello che è capitato in questi 18 mesi il rendimento è stato buono.
Veniamo invece al dettaglio dei vini:
[/fusion_text][fusion_table fusion_table_type=”1″ fusion_table_rows=”12″ fusion_table_columns=”4″ animation_type=”” animation_direction=”left” animation_speed=”0.3″ animation_offset=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” class=”” id=””]
Vino | Costo di Acquisto | Prezzo di Vendita | Crescita |
---|---|---|---|
AMARONE DELLA VALPOLICELLA, DAL FORNO 2013 | 198,00€ | 220,00€ | +11,11% |
CHAMBERTIN, PERROT MINOT 2018 | 750,00€ | 800,00€ | +6,67% |
MAZOYERES-CHAMBERTIN, PERROT MINOT 2018 | 305,00€ | 350,00€ | +14,75% |
ALZERO, QUINTARELLI 2009 | 210,00€ | 230,00€ | +9,52% |
CHAMBOLLE-MUSIGNY LA COMBE D’ORVEAU, PERROT MINOT 2018 | 245,00€ | 290,00€ | +18,37% |
TREBBIANO D’ABRUZZO, VALENTINI 2015 | 50,00€ | 80,00€ | +60,00€ |
BONNES-MARES, BRUNO CLAIR 2016 | 230,00€ | 230,00€ | 0% |
BARBARESCO RABAJA, BRUNO GIACOSA 2016 | 120,00€ | 155,00€ | +29,17% |
BARBARESCO ASILI, BRUNO GIACOSA 2017 | 108,00€ | 125,00€ | +15,74% |
BAROLO, BRUNO GIACOSA 2016 | 115,00€ | 135,00€ | +17,39% |
AMARONE DELLA VALPOLICELLA, QUINTARELLI 2012: | 165,00€ | 185,00€ | +12,12% |
[/fusion_table][/fusion_builder_column][/fusion_builder_row][/fusion_builder_container][fusion_builder_container hundred_percent=”no” equal_height_columns=”no” menu_anchor=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” class=”” id=”” background_color=”” background_image=”” background_position=”center center” background_repeat=”no-repeat” fade=”no” background_parallax=”none” parallax_speed=”0.3″ video_mp4=”” video_webm=”” video_ogv=”” video_url=”” video_aspect_ratio=”16:9″ video_loop=”yes” video_mute=”yes” overlay_color=”” video_preview_image=”” border_size=”” border_color=”” border_style=”solid” padding_top=”” padding_bottom=”” padding_left=”” padding_right=”” margin_top=”30″][fusion_builder_row][fusion_builder_column type=”1_1″ type=”1_1″ background_position=”left top” background_color=”” border_size=”” border_color=”” border_style=”solid” border_position=”all” spacing=”yes” background_image=”” background_repeat=”no-repeat” padding_top=”” padding_right=”” padding_bottom=”” padding_left=”” margin_top=”0px” margin_bottom=”0px” class=”” id=”” animation_type=”” animation_speed=”0.3″ animation_direction=”left” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” center_content=”no” last=”true” min_height=”” hover_type=”none” link=”” first=”true”][fusion_text]
Da questi dati risultano alcune considerazioni importanti:
- nessun vino fa perdita, solo il Bonnes Mares 2016 di Bruno Clair chiude in pareggio. Tutti gli altri guadagnano.
- la performance migliore la fa il Trebbiano Valentini 2015 con un 60%.
- Giacosa, Quintarelli e Perrot Minot si sono dimostrati molto solidi.
Spero via sia stato utile.
[/fusion_text][/fusion_builder_column][/fusion_builder_row][/fusion_builder_container][fusion_builder_container hundred_percent=”no” equal_height_columns=”no” menu_anchor=”” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” class=”” id=”” background_color=”” background_image=”” background_position=”center center” background_repeat=”no-repeat” fade=”no” background_parallax=”none” parallax_speed=”0.3″ video_mp4=”” video_webm=”” video_ogv=”” video_url=”” video_aspect_ratio=”16:9″ video_loop=”yes” video_mute=”yes” overlay_color=”” video_preview_image=”” border_size=”” border_color=”” border_style=”solid” padding_top=”” padding_bottom=”” padding_left=”” padding_right=”” margin_top=”30″][fusion_builder_row][fusion_builder_column type=”1_1″ type=”1_1″ background_position=”left top” background_color=”” border_size=”” border_color=”” border_style=”solid” border_position=”all” spacing=”yes” background_image=”” background_repeat=”no-repeat” padding_top=”” padding_right=”” padding_bottom=”” padding_left=”” margin_top=”0px” margin_bottom=”0px” class=”” id=”” animation_type=”” animation_speed=”0.3″ animation_direction=”left” hide_on_mobile=”small-visibility,medium-visibility,large-visibility” center_content=”no” last=”true” min_height=”” hover_type=”none” link=”” first=”true”][fusion_code]PHN0eWxlPgogI19mb3JtXzlfIHsgZm9udC1zaXplOjE0cHg7IGxpbmUtaGVpZ2h0OjEuNjsgZm9udC1mYW1pbHk6YXJpYWwsIGhlbHZldGljYSwgc2Fucy1zZXJpZjsgbWFyZ2luOjA7IH0KICNfZm9ybV85XyAqIHsgb3V0bGluZTowOyB9CiAuX2Zvcm1faGlkZSB7IGRpc3BsYXk6bm9uZTsgdmlzaWJpbGl0eTpoaWRkZW47IH0KIC5fZm9ybV9zaG93IHsgZGlzcGxheTpibG9jazsgdmlzaWJpbGl0eTp2aXNpYmxlOyB9CiAjX2Zvcm1fOV8uX2Zvcm0tdG9wIHsgdG9wOjA7IH0KICNfZm9ybV85Xy5fZm9ybS1ib3R0b20geyBib3R0b206MDsgfQogI19mb3JtXzlfLl9mb3JtLWxlZnQgeyBsZWZ0OjA7IH0KICNfZm9ybV85Xy5fZm9ybS1yaWdodCB7IHJpZ2h0OjA7IH0KICNfZm9ybV85XyBpbnB1dFt0eXBlPSJ0ZXh0Il0sI19mb3JtXzlfIGlucHV0W3R5cGU9ImRhdGUiXSwjX2Zvcm1fOV8gdGV4dGFyZWEgeyBwYWRkaW5nOjZweDsgaGVpZ2h0OmF1dG87IGJvcmRlcjojOTc5Nzk3IDFweCBzb2xpZDsgYm9yZGVyLXJhZGl1czo0cHg7IGNvbG9yOiMwMDAgIWltcG9ydGFudDsgZm9udC1zaXplOjE0cHg7IC13ZWJraXQtYm94LXNpemluZzpib3JkZXItYm94OyAtbW96LWJveC1zaXppbmc6Ym9yZ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m9wdGlvbnMubGVuZ3RoOyBpKyspIHsKICAgICAgICAgICAgaWYgKGVsZW0ub3B0aW9uc1tpXS5zZWxlY3RlZCkgewogICAgICAgICAgICAgIHNlbGVjdGVkID0gdHJ1ZTsKICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGVsZW0ub3B0aW9ucy5sZW5ndGg7IGkrKykgewogICAgICAgICAgICBpZiAoZWxlbS5vcHRpb25zW2ldLnNlbGVjdGVkICYmICFlbGVtLm9wdGlvbnNbaV0udmFsdWUpIHsKICAgICAgICAgICAgICBzZWxlY3RlZCA9IGZhbHNlOwogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmICghc2VsZWN0ZWQpIHsKICAgICAgICAgIGVsZW0uY2xhc3NOYW1lID0gZWxlbS5jbGFzc05hbWUgKyAnIF9oYXNfZXJyb3InOwogICAgICAgICAgbm9fZXJyb3IgPSBmYWxzZTsKICAgICAgICAgIHRvb2x0aXAgPSBjcmVhdGVfdG9vbHRpcChlbGVtLCAiU2VsZXppb25hIHVuXCdvcHppb25lLiIpOwogICAgICAgIH0KICAgICAgfSBlbHNlIGlmICh2YWx1ZSA9PT0gdW5kZWZpbmVkIHx8IHZhbHVlID09PSBudWxsIHx8IHZhbHVlID09PSAnJykgewogICAgICAgIGVsZW0uY2xhc3NOYW1lID0gZWxlbS5jbGFzc05hbWUgKyAnIF9oYXNfZXJyb3InOwogICAgICAgIG5vX2Vycm9yID0gZmFsc2U7CiAgICAgICAgdG9vbHRpcCA9IGNyZWF0ZV90b29sdGlwKGVsZW0sICJRdWVzdG8gY2FtcG8gw6ggb2JibGlnYXRvcmlvLiIpOwogICAgICB9CiAgICB9CiAgICBpZiAobm9fZXJyb3IgJiYgZWxlbS5uYW1lID09ICdlbWFpbCcpIHsKICAgICAgaWYgKCF2YWx1ZS5tYXRjaCgvXltcK19hLXowLTktJyY9XSsoXC5bXCtfYS16MC05LSddKykqQFthLXowLTktXSsoXC5bYS16MC05LV0rKSooXC5bYS16XXsyLH0pJC9pKSkgewogICAgICAgIGVsZW0uY2xhc3NOYW1lID0gZWxlbS5jbGFzc05hbWUgKyAnIF9oYXNfZXJyb3InOwogICAgICAgIG5vX2Vycm9yID0gZmFsc2U7CiAgICAgICAgdG9vbHRpcCA9IGNyZWF0ZV90b29sdGlwKGVsZW0sICJJbnNlcmlzY2kgdW4gaW5kaXJpenpvIGVtYWlsIHZhbGlkby4iKTsKICAgICAgfQogICAgfQogICAgaWYgKG5vX2Vycm9yICYmIC9kYXRlX2ZpZWxkLy50ZXN0KGVsZW0uY2xhc3NOYW1lKSkgewogICAgICBpZiAoIXZhbHVlLm1hdGNoKC9eXGRcZFxkXGQtXGRcZC1cZFxkJC8pKSB7CiAgICAgICAgZWxlbS5jbGFzc05hbWUgPSBlbGVtLmNsYXNzTmFtZSArICcgX2hhc19lcnJvcic7CiAgICAgICAgbm9fZXJyb3IgPSBmYWxzZTsKICAgICAgICB0b29sdGlwID0gY3JlYXRlX3Rvb2x0aXAoZWxlbSwgIkluc2VyaXNjaSB1bmEgZGF0YSB2YWxpZGEuIik7CiAgICAgIH0KICAgIH0KICAgIHRvb2x0aXAgPyByZXNpemVfdG9vbHRpcCh0b29sdGlwKSA6IGZhbHNlOwogICAgcmV0dXJuIG5vX2Vycm9yOwogIH07CiAgdmFyIG5lZWRzX3ZhbGlkYXRlID0gZnVuY3Rpb24oZWwpIHsKICAgICAgICBpZihlbC5nZXRBdHRyaWJ1dGUoJ3JlcXVpcmVkJykgIT09IG51bGwpewogICAgICAgICAgICByZXR1cm4gdHJ1ZQogICAgICAgIH0KICAgICAgICBpZihlbC5uYW1lID09PSAnZW1haWwnICYmIGVsLnZhbHVlICE9PSAiIil7CiAgICAgICAgICAgIHJldHVybiB0cnVlCiAgICAgICAgfQogICAgICAgIHJldHVybiBmYWxzZQogIH07Ci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Rpb3NbaV0sICdjbGljaycsIGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgICB2YWxpZGF0ZV9maWVsZChlbCwgdHJ1ZSk7CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pKGlucHV0KTsKICAgICAgICAgIH0gZWxzZSBpZiAoaW5wdXQudGFnTmFtZSA9PSAnU0VMRUNUJykgewogICAgICAgICAgICBhZGRFdmVudChpbnB1dCwgJ2NoYW5nZScsIGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgIHZhbGlkYXRlX2ZpZWxkKHRoaXMsIHRydWUpOwogICAgICAgICAgICB9KTsKICAgICAgICAgIH0gZWxzZSBpZiAoaW5wdXQudHlwZSA9PSAndGV4dGFyZWEnKXsKICAgICAgICAgICAgYWRkRXZlbnQoaW5wdXQsICdpbnB1dCcsIGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgIHZhbGlkYXRlX2ZpZWxkKHRoaXMsIHRydWUpOwogICAgICAgICAgICB9KTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgIH0KICAgIHJlbW92ZV90b29sdGlwcygpOwogICAgZm9yICh2YXIgaSA9IDAsIGxlbiA9IGFsbElucHV0cy5sZW5ndGg7IGkgPCBsZW47IGkrKykgewogICAgICB2YXIgZWxlbSA9IGFsbElucHV0c1tpXTsKICAgICAgaWYgKG5lZWRzX3ZhbGlkYXRlKGVsZW0pKSB7CiAgICAgICAgaWYgKGVsZW0udGFnTmFtZS50b0xvd2VyQ2FzZSgpICE9PSAic2VsZWN0IikgewogICAgICAgICAgZWxlbS52YWx1ZSA9IGVsZW0udmFsdWUudHJpbSgpOwogICAgICAgIH0KICAgICAgICB2YWxpZGF0ZV9maWVsZChlbGVtKSA/IHRydWUgOiBub19lcnJvciA9IGZhbHNlOwogICAgICB9CiAgICB9CiAgICBpZiAoIW5vX2Vycm9yICYmIGUpIHsKICAgICAgZS5wcmV2ZW50RGVmYXVsdCgpOw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TBBL2csICdcXG4nKTsKICAgICAgdmFyIGVyciA9IGZvcm1fdG9fc3VibWl0LnF1ZXJ5U2VsZWN0b3IoJy5fZm9ybV9lcnJvcicpOwogICAgICBlcnIgPyBlcnIucGFyZW50Tm9kZS5yZW1vdmVDaGlsZChlcnIpIDogZmFsc2U7CiAgICAgIF9sb2FkX3NjcmlwdCgnaHR0cHM6Ly9ncmFuZGlib3R0aWdsaWUuYWN0aXZlaG9zdGVkLmNvbS9wcm9jLnBocD8nICsgc2VyaWFsaXplZCArICcmanNvbnA9dHJ1ZScpOwogICAgfQogICAgcmV0dXJuIGZhbHNlOwogIH07CiAgYWRkRXZlbnQoZm9ybV90b19zdWJtaXQsICdzdWJtaXQnLCBmb3JtX3N1Ym1pdCk7Cn0pKCk7Cgo8L3NjcmlwdD4=[/fusion_code][/fusion_builder_column][/fusion_builder_row][/fusion_builder_container]